Skip to content

Commit

Permalink
refactor: add and use SampleCount::no_multisampling ctor.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Oct 13, 2024
1 parent ba77bd6 commit 7d8934a
Show file tree
Hide file tree
Showing 44 changed files with 73 additions and 68 deletions.
4 changes: 2 additions & 2 deletions benches/benches/renderpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl RenderpassState {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
Expand Down Expand Up @@ -230,7 +230,7 @@ impl RenderpassState {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/bunnymark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl crate::framework::Example for Example {
label: None,
size,
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::COPY_DST | wgpu::TextureUsages::TEXTURE_BINDING,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/conservative_raster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Example {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: RENDER_TARGET_FORMAT,
usage: wgpu::TextureUsages::TEXTURE_BINDING
Expand Down
2 changes: 1 addition & 1 deletion examples/src/cube/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl crate::framework::Example for Example {
label: None,
size: texture_extent,
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::R8Uint,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ impl<E: Example + wgpu::WasmNotSendSync> From<ExampleTestParams<E>>
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/mipmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl crate::framework::Example for Example {
let texture = device.create_texture(&wgpu::TextureDescriptor {
size: texture_extent,
mip_level_count: MIP_LEVEL_COUNT,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: TEXTURE_FORMAT,
usage: wgpu::TextureUsages::TEXTURE_BINDING
Expand Down
2 changes: 1 addition & 1 deletion examples/src/msaa_line/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl crate::framework::Example for Example {
// supported sample counts to the user.
Key::Named(NamedKey::ArrowLeft) => {
if self.sample_count == self.max_sample_count {
self.sample_count = SampleCount::new(1);
self.sample_count = SampleCount::no_multisampling();
self.rebuild_bundle = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/render_to_texture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn run(_path: Option<String>) {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
Expand Down
4 changes: 2 additions & 2 deletions examples/src/shadow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl Example {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: Self::DEPTH_FORMAT,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down Expand Up @@ -381,7 +381,7 @@ impl crate::framework::Example for Example {
let shadow_texture = device.create_texture(&wgpu::TextureDescriptor {
size: Self::SHADOW_SIZE,
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: Self::SHADOW_FORMAT,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
Expand Down
4 changes: 2 additions & 2 deletions examples/src/skybox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Example {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: Self::DEPTH_FORMAT,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down Expand Up @@ -329,7 +329,7 @@ impl crate::framework::Example for Example {
&wgpu::TextureDescriptor {
size,
mip_level_count: header.level_count,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: skybox_format,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
Expand Down
4 changes: 2 additions & 2 deletions examples/src/stencil_triangles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl crate::framework::Example for Example {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Stencil8,
view_formats: &[],
Expand Down Expand Up @@ -185,7 +185,7 @@ impl crate::framework::Example for Example {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Stencil8,
view_formats: &[],
Expand Down
2 changes: 1 addition & 1 deletion examples/src/storage_texture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn run(_path: Option<String>) {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::COPY_SRC,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/texture_arrays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl crate::framework::Example for Example {
let texture_descriptor = wgpu::TextureDescriptor {
size: wgpu::Extent3d::default(),
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/timestamp_queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fn render_pass(
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down
6 changes: 3 additions & 3 deletions examples/src/water/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl Example {
label: Some("Reflection Render Texture"),
size: texture_extent,
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: config.view_formats[0],
usage: wgpu::TextureUsages::TEXTURE_BINDING
Expand All @@ -201,7 +201,7 @@ impl Example {
label: Some("Depth Buffer"),
size: texture_extent,
mip_level_count: 1,
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Depth32Float,
usage: wgpu::TextureUsages::TEXTURE_BINDING
Expand Down Expand Up @@ -620,7 +620,7 @@ impl crate::framework::Example for Example {
depth_read_only: false,
stencil_read_only: true,
}),
sample_count: SampleCount::new(1),
sample_count: SampleCount::no_multisampling(),
multiview: None,
});
encoder.set_pipeline(&terrain_pipeline);
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/bgra8unorm_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new()
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Bgra8Unorm,
usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::COPY_SRC,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/clear_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ async fn single_texture_clear_test(
// arbitrary value between 2 and max
3
},
sample_count: wgpu::SampleCount::new(1), // multisampling is not supported for clear
sample_count: wgpu::SampleCount::no_multisampling(), // multisampling is not supported for clear
dimension,
format,
usage: wgpu::TextureUsages::COPY_SRC | extra_usages,
Expand Down
12 changes: 6 additions & 6 deletions tests/tests/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand All @@ -156,7 +156,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::COPY_SRC,
Expand All @@ -167,7 +167,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::COPY_DST,
Expand Down Expand Up @@ -306,7 +306,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
depth_or_array_layers: 1,
},
mip_level_count: 2,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::COPY_SRC,
Expand Down Expand Up @@ -757,7 +757,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgt::TextureDimension::D2,
format: wgt::TextureFormat::Rgba8Unorm,
usage: wgt::TextureUsages::RENDER_ATTACHMENT | wgt::TextureUsages::TEXTURE_BINDING,
Expand Down Expand Up @@ -856,7 +856,7 @@ static DEVICE_DESTROY_THEN_BUFFER_CLEANUP: GpuTestConfiguration = GpuTestConfigu
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down
6 changes: 3 additions & 3 deletions tests/tests/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::ne
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::R8Unorm,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down Expand Up @@ -110,7 +110,7 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::COPY_DST,
Expand All @@ -135,7 +135,7 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) {
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/external_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static IMAGE_BITMAP_IMPORT: GpuTestConfiguration =
depth_or_array_layers: dest_layers,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/float32_filterable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn create_texture_binding(device: &wgpu::Device, format: wgpu::TextureFormat, fi
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/life_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static TEXTURE_DESTROY: GpuTestConfiguration =
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1), // multisampling is not supported for clear
sample_count: wgpu::SampleCount::no_multisampling(), // multisampling is not supported for clear
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Snorm,
usage: wgpu::TextureUsages::COPY_DST | wgpu::TextureUsages::TEXTURE_BINDING,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/mem_leaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async fn draw_test_with_reports(
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_DST,
Expand Down
12 changes: 6 additions & 6 deletions tests/tests/nv12_texture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati
format: wgpu::TextureFormat::NV12,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
view_formats: &[],
});
let y_view = tex.create_view(&wgpu::TextureViewDescriptor {
Expand Down Expand Up @@ -92,7 +92,7 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati
label: None,
size,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: target_format,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down Expand Up @@ -138,7 +138,7 @@ static NV12_TEXTURE_VIEW_PLANE_ON_NON_PLANAR_FORMAT: GpuTestConfiguration =
format: wgpu::TextureFormat::R8Unorm,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
view_formats: &[],
});
fail(
Expand Down Expand Up @@ -169,7 +169,7 @@ static NV12_TEXTURE_VIEW_PLANE_OUT_OF_BOUNDS: GpuTestConfiguration = GpuTestConf
format: wgpu::TextureFormat::NV12,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
view_formats: &[],
});
fail(
Expand Down Expand Up @@ -201,7 +201,7 @@ static NV12_TEXTURE_BAD_FORMAT_VIEW_PLANE: GpuTestConfiguration = GpuTestConfigu
format: wgpu::TextureFormat::NV12,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
view_formats: &[],
});
fail(
Expand Down Expand Up @@ -237,7 +237,7 @@ static NV12_TEXTURE_BAD_SIZE: GpuTestConfiguration = GpuTestConfiguration::new()
format: wgpu::TextureFormat::NV12,
usage: wgpu::TextureUsages::TEXTURE_BINDING,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
view_formats: &[],
});
},
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/occlusion_query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static OCCLUSION_QUERY: GpuTestConfiguration = GpuTestConfiguration::new()
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Depth32Float,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/partially_bounded_arrays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static PARTIALLY_BOUNDED_ARRAY: GpuTestConfiguration = GpuTestConfiguration::new
label: None,
size: texture_extent,
mip_level_count: 1,
sample_count: wgpu::SampleCount::new(1),
sample_count: wgpu::SampleCount::no_multisampling(),
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba32Float,
usage: wgpu::TextureUsages::TEXTURE_BINDING
Expand Down
Loading

0 comments on commit 7d8934a

Please sign in to comment.