use std::sync::Arc;
use wgpu::{Texture, TextureFormat, TextureView, TextureViewDescriptor};
#[derive(Debug)]
pub struct ScreenFrame {
texture: Arc<Texture>,
width: u32,
height: u32,
format: TextureFormat,
timestamp_ns: u64,
}
impl ScreenFrame {
#[must_use]
pub const fn from_texture(
texture: Arc<Texture>,
width: u32,
height: u32,
format: TextureFormat,
timestamp_ns: u64,
) -> Self {
Self {
texture,
width,
height,
format,
timestamp_ns,
}
}
#[must_use]
pub fn texture(&self) -> &Texture {
&self.texture
}
#[must_use]
pub const fn width(&self) -> u32 {
self.width
}
#[must_use]
pub const fn height(&self) -> u32 {
self.height
}
#[must_use]
pub const fn format(&self) -> TextureFormat {
self.format
}
#[must_use]
pub const fn timestamp_ns(&self) -> u64 {
self.timestamp_ns
}
#[must_use]
pub fn create_view(&self) -> TextureView {
self.texture.create_view(&TextureViewDescriptor::default())
}
}