pub struct MsaaTarget {
pub texture: wgpu::Texture,
pub view: wgpu::TextureView,
pub sample_count: u32,
pub format: wgpu::TextureFormat,
pub size: wgpu::Extent3d,
}
impl MsaaTarget {
pub fn new(
device: &wgpu::Device,
format: wgpu::TextureFormat,
size: wgpu::Extent3d,
sample_count: u32,
) -> Self {
let texture = device.create_texture(&wgpu::TextureDescriptor {
label: Some("aetna_wgpu::msaa_target"),
size,
mip_level_count: 1,
sample_count,
dimension: wgpu::TextureDimension::D2,
format,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
view_formats: &[],
});
let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
Self {
texture,
view,
sample_count,
format,
size,
}
}
pub fn matches(&self, size: wgpu::Extent3d) -> bool {
self.size.width == size.width
&& self.size.height == size.height
&& self.size.depth_or_array_layers == size.depth_or_array_layers
}
}