diff --git a/benches/benches/wgpu-benchmark/renderpass.rs b/benches/benches/wgpu-benchmark/renderpass.rs index 2eb566717..946c32bfe 100644 --- a/benches/benches/wgpu-benchmark/renderpass.rs +++ b/benches/benches/wgpu-benchmark/renderpass.rs @@ -360,6 +360,7 @@ impl RenderpassState { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.render_target, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), @@ -406,6 +407,7 @@ impl RenderpassState { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.render_target, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/deno_webgpu/command_encoder.rs b/deno_webgpu/command_encoder.rs index 4715741d6..1a6317a27 100644 --- a/deno_webgpu/command_encoder.rs +++ b/deno_webgpu/command_encoder.rs @@ -63,6 +63,7 @@ impl GPUCommandEncoder { attachment.into_option().map(|attachment| { wgpu_core::command::RenderPassColorAttachment { view: attachment.view.id, + depth_slice: attachment.depth_slice, resolve_target: attachment.resolve_target.map(|target| target.id), load_op: attachment .load_op diff --git a/deno_webgpu/render_pass.rs b/deno_webgpu/render_pass.rs index cdb8bd8f6..97f1bd8e8 100644 --- a/deno_webgpu/render_pass.rs +++ b/deno_webgpu/render_pass.rs @@ -402,8 +402,8 @@ pub(crate) struct GPURenderPassDescriptor { #[webidl(dictionary)] pub(crate) struct GPURenderPassColorAttachment { pub view: Ptr, - /*#[options(enforce_range = true)] - pub depth_slice: Option,*/ + #[options(enforce_range = true)] + pub depth_slice: Option, pub resolve_target: Option>, pub clear_value: Option, pub load_op: GPULoadOp, diff --git a/examples/features/src/boids/mod.rs b/examples/features/src/boids/mod.rs index a5364548d..9ee19a550 100644 --- a/examples/features/src/boids/mod.rs +++ b/examples/features/src/boids/mod.rs @@ -263,6 +263,7 @@ impl crate::framework::Example for Example { // create render pass descriptor and its color attachments let color_attachments = [Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/examples/features/src/bunnymark/mod.rs b/examples/features/src/bunnymark/mod.rs index 45fc72d0c..9ac69cac3 100644 --- a/examples/features/src/bunnymark/mod.rs +++ b/examples/features/src/bunnymark/mod.rs @@ -112,6 +112,7 @@ impl Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(clear_color), diff --git a/examples/features/src/conservative_raster/mod.rs b/examples/features/src/conservative_raster/mod.rs index 1db6e0983..c05f0cb91 100644 --- a/examples/features/src/conservative_raster/mod.rs +++ b/examples/features/src/conservative_raster/mod.rs @@ -263,6 +263,7 @@ impl crate::framework::Example for Example { label: Some("low resolution"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.low_res_target, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), @@ -284,6 +285,7 @@ impl crate::framework::Example for Example { label: Some("full resolution"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/examples/features/src/cube/mod.rs b/examples/features/src/cube/mod.rs index 8d0a28ab0..f3e9f7680 100644 --- a/examples/features/src/cube/mod.rs +++ b/examples/features/src/cube/mod.rs @@ -341,6 +341,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/hello_triangle/mod.rs b/examples/features/src/hello_triangle/mod.rs index cba78face..89ef9864f 100644 --- a/examples/features/src/hello_triangle/mod.rs +++ b/examples/features/src/hello_triangle/mod.rs @@ -118,6 +118,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/hello_windows/mod.rs b/examples/features/src/hello_windows/mod.rs index 2fb24a081..9885d2402 100644 --- a/examples/features/src/hello_windows/mod.rs +++ b/examples/features/src/hello_windows/mod.rs @@ -119,6 +119,7 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc, wgpu::Color color_attachments: &[Some( wgpu::RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear( diff --git a/examples/features/src/mipmap/mod.rs b/examples/features/src/mipmap/mod.rs index 569a99923..f9d4febaf 100644 --- a/examples/features/src/mipmap/mod.rs +++ b/examples/features/src/mipmap/mod.rs @@ -160,6 +160,7 @@ impl Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &views[target_mip], + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::WHITE), @@ -481,6 +482,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(clear_color), diff --git a/examples/features/src/msaa_line/mod.rs b/examples/features/src/msaa_line/mod.rs index f956235cc..6a8e86268 100644 --- a/examples/features/src/msaa_line/mod.rs +++ b/examples/features/src/msaa_line/mod.rs @@ -279,6 +279,7 @@ impl crate::framework::Example for Example { let rpass_color_attachment = if self.sample_count == 1 { wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), @@ -288,6 +289,7 @@ impl crate::framework::Example for Example { } else { wgpu::RenderPassColorAttachment { view: &self.multisampled_framebuffer, + depth_slice: None, resolve_target: Some(view), ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/examples/features/src/multiple_render_targets/mod.rs b/examples/features/src/multiple_render_targets/mod.rs index 68eb3d2a5..61726c3fb 100644 --- a/examples/features/src/multiple_render_targets/mod.rs +++ b/examples/features/src/multiple_render_targets/mod.rs @@ -329,6 +329,7 @@ impl TargetRenderer { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: surface_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), @@ -508,11 +509,13 @@ impl crate::framework::Example for Example { &[ Some(wgpu::RenderPassColorAttachment { view: &self.texture_targets.red_view, + depth_slice: None, resolve_target: None, ops: Default::default(), }), Some(wgpu::RenderPassColorAttachment { view: &self.texture_targets.green_view, + depth_slice: None, resolve_target: None, ops: Default::default(), }), diff --git a/examples/features/src/ray_cube_compute/mod.rs b/examples/features/src/ray_cube_compute/mod.rs index 24f218287..10493390a 100644 --- a/examples/features/src/ray_cube_compute/mod.rs +++ b/examples/features/src/ray_cube_compute/mod.rs @@ -462,6 +462,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/ray_cube_fragment/mod.rs b/examples/features/src/ray_cube_fragment/mod.rs index 11e45e428..96be61c3b 100644 --- a/examples/features/src/ray_cube_fragment/mod.rs +++ b/examples/features/src/ray_cube_fragment/mod.rs @@ -349,6 +349,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/ray_cube_normals/mod.rs b/examples/features/src/ray_cube_normals/mod.rs index 79bcc35f2..5b80e5c04 100644 --- a/examples/features/src/ray_cube_normals/mod.rs +++ b/examples/features/src/ray_cube_normals/mod.rs @@ -450,6 +450,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/ray_scene/mod.rs b/examples/features/src/ray_scene/mod.rs index 5f0439674..a4a454817 100644 --- a/examples/features/src/ray_scene/mod.rs +++ b/examples/features/src/ray_scene/mod.rs @@ -529,6 +529,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/ray_shadows/mod.rs b/examples/features/src/ray_shadows/mod.rs index f50f84098..2054632ae 100644 --- a/examples/features/src/ray_shadows/mod.rs +++ b/examples/features/src/ray_shadows/mod.rs @@ -335,6 +335,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/ray_traced_triangle/mod.rs b/examples/features/src/ray_traced_triangle/mod.rs index 8dca777b6..85e1f8851 100644 --- a/examples/features/src/ray_traced_triangle/mod.rs +++ b/examples/features/src/ray_traced_triangle/mod.rs @@ -406,6 +406,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/render_to_texture/mod.rs b/examples/features/src/render_to_texture/mod.rs index 917ac7310..3460864b0 100644 --- a/examples/features/src/render_to_texture/mod.rs +++ b/examples/features/src/render_to_texture/mod.rs @@ -84,6 +84,7 @@ async fn run(_path: Option) { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/shadow/mod.rs b/examples/features/src/shadow/mod.rs index 797ded1ff..4be97dadd 100644 --- a/examples/features/src/shadow/mod.rs +++ b/examples/features/src/shadow/mod.rs @@ -794,6 +794,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/skybox/mod.rs b/examples/features/src/skybox/mod.rs index f10042ee1..38b0e1906 100644 --- a/examples/features/src/skybox/mod.rs +++ b/examples/features/src/skybox/mod.rs @@ -426,6 +426,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/srgb_blend/mod.rs b/examples/features/src/srgb_blend/mod.rs index 8471b3cc5..d91e8cd41 100644 --- a/examples/features/src/srgb_blend/mod.rs +++ b/examples/features/src/srgb_blend/mod.rs @@ -181,6 +181,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/stencil_triangles/mod.rs b/examples/features/src/stencil_triangles/mod.rs index b03aedd5e..5216f2259 100644 --- a/examples/features/src/stencil_triangles/mod.rs +++ b/examples/features/src/stencil_triangles/mod.rs @@ -200,6 +200,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/examples/features/src/texture_arrays/mod.rs b/examples/features/src/texture_arrays/mod.rs index 2123aa20d..1062ff04b 100644 --- a/examples/features/src/texture_arrays/mod.rs +++ b/examples/features/src/texture_arrays/mod.rs @@ -392,6 +392,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/examples/features/src/timestamp_queries/mod.rs b/examples/features/src/timestamp_queries/mod.rs index 7bac87e1a..c0fce563d 100644 --- a/examples/features/src/timestamp_queries/mod.rs +++ b/examples/features/src/timestamp_queries/mod.rs @@ -380,6 +380,7 @@ fn render_pass( label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &render_target_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/uniform_values/mod.rs b/examples/features/src/uniform_values/mod.rs index 3a6933bf1..3ee867672 100644 --- a/examples/features/src/uniform_values/mod.rs +++ b/examples/features/src/uniform_values/mod.rs @@ -307,6 +307,7 @@ async fn run(event_loop: EventLoop<()>, window: Arc) { color_attachments: &[Some( wgpu::RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/examples/features/src/water/mod.rs b/examples/features/src/water/mod.rs index 0d7597f5e..08b8f57e0 100644 --- a/examples/features/src/water/mod.rs +++ b/examples/features/src/water/mod.rs @@ -731,6 +731,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.reflect_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(back_color), @@ -760,6 +761,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(back_color), @@ -789,6 +791,7 @@ impl crate::framework::Example for Example { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Load, diff --git a/examples/standalone/02_hello_window/src/main.rs b/examples/standalone/02_hello_window/src/main.rs index 83687e281..fc0d278a9 100644 --- a/examples/standalone/02_hello_window/src/main.rs +++ b/examples/standalone/02_hello_window/src/main.rs @@ -97,6 +97,7 @@ impl State { label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), diff --git a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs index fee57b0a1..320cf3e10 100644 --- a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs +++ b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs @@ -210,6 +210,7 @@ async fn binding_array_sampled_textures(ctx: TestingContext, partially_bound: bo label: Some("Render Pass"), color_attachments: &[Some(RenderPassColorAttachment { view: &output_view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(Color::BLACK), diff --git a/tests/tests/wgpu-gpu/device.rs b/tests/tests/wgpu-gpu/device.rs index 54e3adc8e..7411aa35a 100644 --- a/tests/tests/wgpu-gpu/device.rs +++ b/tests/tests/wgpu-gpu/device.rs @@ -369,6 +369,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne ops: wgpu::Operations::default(), resolve_target: None, view: &target_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/draw_indirect.rs b/tests/tests/wgpu-gpu/draw_indirect.rs index 5b9384edd..ac88c43bc 100644 --- a/tests/tests/wgpu-gpu/draw_indirect.rs +++ b/tests/tests/wgpu-gpu/draw_indirect.rs @@ -241,6 +241,7 @@ async fn run_test(ctx: TestingContext, test_data: TestData, expect_noop: bool) { ops: wgpu::Operations::default(), resolve_target: None, view: &out_texture_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, @@ -707,6 +708,7 @@ async fn indirect_buffer_offsets(ctx: TestingContext) { ops: wgpu::Operations::default(), resolve_target: None, view: &out_texture_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/encoder.rs b/tests/tests/wgpu-gpu/encoder.rs index 82fd1eda1..7ab047977 100644 --- a/tests/tests/wgpu-gpu/encoder.rs +++ b/tests/tests/wgpu-gpu/encoder.rs @@ -55,6 +55,7 @@ static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::ne ops: wgpu::Operations::default(), resolve_target: None, view: &target_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, @@ -285,6 +286,7 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) { .begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &color_attachment_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations::default(), })], diff --git a/tests/tests/wgpu-gpu/mem_leaks.rs b/tests/tests/wgpu-gpu/mem_leaks.rs index 52d061033..0d03f9d37 100644 --- a/tests/tests/wgpu-gpu/mem_leaks.rs +++ b/tests/tests/wgpu-gpu/mem_leaks.rs @@ -187,6 +187,7 @@ async fn draw_test_with_reports( ops: wgpu::Operations::default(), resolve_target: None, view: &texture_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/nv12_texture/mod.rs b/tests/tests/wgpu-gpu/nv12_texture/mod.rs index 6ded163a3..33fe17e88 100644 --- a/tests/tests/wgpu-gpu/nv12_texture/mod.rs +++ b/tests/tests/wgpu-gpu/nv12_texture/mod.rs @@ -109,6 +109,7 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati ops: wgpu::Operations::default(), resolve_target: None, view: &target_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/push_constants.rs b/tests/tests/wgpu-gpu/push_constants.rs index 4c0a936b9..b3119442f 100644 --- a/tests/tests/wgpu-gpu/push_constants.rs +++ b/tests/tests/wgpu-gpu/push_constants.rs @@ -301,6 +301,7 @@ async fn render_pass_test(ctx: &TestingContext, use_render_bundle: bool) { label: Some("Render Pass"), color_attachments: &[Some(RenderPassColorAttachment { view: &output_texture_view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(Color::default()), diff --git a/tests/tests/wgpu-gpu/regression/issue_3349.rs b/tests/tests/wgpu-gpu/regression/issue_3349.rs index 21929bd9b..14629636a 100644 --- a/tests/tests/wgpu-gpu/regression/issue_3349.rs +++ b/tests/tests/wgpu-gpu/regression/issue_3349.rs @@ -151,6 +151,7 @@ async fn multi_stage_data_binding_test(ctx: TestingContext) { label: Some("rpass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/tests/tests/wgpu-gpu/regression/issue_3457.rs b/tests/tests/wgpu-gpu/regression/issue_3457.rs index 3edd2c78b..e71e97d84 100644 --- a/tests/tests/wgpu-gpu/regression/issue_3457.rs +++ b/tests/tests/wgpu-gpu/regression/issue_3457.rs @@ -141,6 +141,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration = label: Some("double renderpass"), color_attachments: &[Some(RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(Color::BLACK), @@ -176,6 +177,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration = label: Some("single renderpass"), color_attachments: &[Some(RenderPassColorAttachment { view: &view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(Color::BLACK), diff --git a/tests/tests/wgpu-gpu/regression/issue_4485.rs b/tests/tests/wgpu-gpu/regression/issue_4485.rs index 4944afe49..9d6c83955 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4485.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4485.rs @@ -76,6 +76,7 @@ async fn test_impl(ctx: &TestingContext) { label: Some("Renderpass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { // Important: this isn't the color expected below diff --git a/tests/tests/wgpu-gpu/regression/issue_4514.rs b/tests/tests/wgpu-gpu/regression/issue_4514.rs index b3609ff9a..b523dcd33 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4514.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4514.rs @@ -76,6 +76,7 @@ async fn test_impl(ctx: &TestingContext) { label: Some("Renderpass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { // Important: this isn't the color expected below diff --git a/tests/tests/wgpu-gpu/render_pass_ownership.rs b/tests/tests/wgpu-gpu/render_pass_ownership.rs index 92136899d..e3574e376 100644 --- a/tests/tests/wgpu-gpu/render_pass_ownership.rs +++ b/tests/tests/wgpu-gpu/render_pass_ownership.rs @@ -66,6 +66,7 @@ async fn render_pass_resource_ownership(ctx: TestingContext) { label: Some("render_pass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &color_attachment_view, + depth_slice: None, resolve_target: Some(&color_attachment_resolve_view), ops: wgpu::Operations::default(), })], @@ -147,6 +148,7 @@ async fn render_pass_query_set_ownership_pipeline_statistics(ctx: TestingContext let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &color_attachment_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations::default(), })], @@ -217,6 +219,7 @@ async fn render_pass_query_set_ownership_timestamps(ctx: TestingContext) { let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &color_attachment_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations::default(), })], @@ -274,6 +277,7 @@ async fn render_pass_keep_encoder_alive(ctx: TestingContext) { let rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &color_attachment_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations::default(), })], diff --git a/tests/tests/wgpu-gpu/render_target.rs b/tests/tests/wgpu-gpu/render_target.rs index d47c766ae..6a89fb175 100644 --- a/tests/tests/wgpu-gpu/render_target.rs +++ b/tests/tests/wgpu-gpu/render_target.rs @@ -177,6 +177,7 @@ async fn run_test( label: None, color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: ms_texture_view.as_ref().unwrap_or(&out_texture_view), + depth_slice: None, resolve_target: multisample.then_some(&out_texture_view), ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), diff --git a/tests/tests/wgpu-gpu/scissor_tests/mod.rs b/tests/tests/wgpu-gpu/scissor_tests/mod.rs index 583be021f..ab958daf3 100644 --- a/tests/tests/wgpu-gpu/scissor_tests/mod.rs +++ b/tests/tests/wgpu-gpu/scissor_tests/mod.rs @@ -74,6 +74,7 @@ async fn scissor_test_impl( label: Some("Renderpass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Clear(wgpu::Color { diff --git a/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs b/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs index 10708a24a..83832c01d 100644 --- a/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs +++ b/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs @@ -184,6 +184,7 @@ async fn pulling_common( }, resolve_target: None, view: &color_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/shader_view_format/mod.rs b/tests/tests/wgpu-gpu/shader_view_format/mod.rs index 363a01d1b..849e050b8 100644 --- a/tests/tests/wgpu-gpu/shader_view_format/mod.rs +++ b/tests/tests/wgpu-gpu/shader_view_format/mod.rs @@ -142,6 +142,7 @@ async fn reinterpret( ops: wgpu::Operations::default(), resolve_target: None, view: &target_view, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/vertex_formats/mod.rs b/tests/tests/wgpu-gpu/vertex_formats/mod.rs index eeb0ccc40..f63bc2d69 100644 --- a/tests/tests/wgpu-gpu/vertex_formats/mod.rs +++ b/tests/tests/wgpu-gpu/vertex_formats/mod.rs @@ -351,6 +351,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) { ops: wgpu::Operations::default(), resolve_target: None, view: &dummy, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/vertex_indices/mod.rs b/tests/tests/wgpu-gpu/vertex_indices/mod.rs index 7a02ea6a9..709380ff3 100644 --- a/tests/tests/wgpu-gpu/vertex_indices/mod.rs +++ b/tests/tests/wgpu-gpu/vertex_indices/mod.rs @@ -357,6 +357,7 @@ async fn vertex_index_common(ctx: TestingContext) { ops: wgpu::Operations::default(), resolve_target: None, view: &dummy, + depth_slice: None, })], depth_stencil_attachment: None, timestamp_writes: None, diff --git a/tests/tests/wgpu-gpu/zero_init_texture_after_discard.rs b/tests/tests/wgpu-gpu/zero_init_texture_after_discard.rs index 570d99e83..fa3f70023 100644 --- a/tests/tests/wgpu-gpu/zero_init_texture_after_discard.rs +++ b/tests/tests/wgpu-gpu/zero_init_texture_after_discard.rs @@ -227,6 +227,7 @@ impl<'ctx> TestCase<'ctx> { color_attachments: &[self.format.has_color_aspect().then_some( RenderPassColorAttachment { view: &self.texture.create_view(&TextureViewDescriptor::default()), + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Load, diff --git a/wgpu-core/src/command/clear.rs b/wgpu-core/src/command/clear.rs index 8feb1e389..edf279955 100644 --- a/wgpu-core/src/command/clear.rs +++ b/wgpu-core/src/command/clear.rs @@ -461,6 +461,7 @@ fn clear_texture_via_render_passes( ), usage: wgt::TextureUses::COLOR_TARGET, }, + depth_slice: None, resolve_target: None, ops: hal::AttachmentOps::STORE, clear_value: wgt::Color::TRANSPARENT, diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 46d84773c..edb4f8b3a 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -162,6 +162,8 @@ impl ResolvedPassChannel { pub struct RenderPassColorAttachment { /// The view to use as an attachment. pub view: TV, + /// The depth slice index of a 3D view. It must not be provided if the view is not 3D. + pub depth_slice: Option, /// The view that will receive the resolved output if multisampling is used. pub resolve_target: Option, /// Operation to perform to the output attachment at the start of a @@ -1201,6 +1203,7 @@ impl<'d> RenderPassInfo<'d> { view: color_view.try_raw(snatch_guard)?, usage: wgt::TextureUses::COLOR_TARGET, }, + depth_slice: at.depth_slice, resolve_target: hal_resolve_target, ops: at.hal_ops(), clear_value: at.clear_value(), @@ -1417,6 +1420,7 @@ impl Global { for color_attachment in desc.color_attachments.iter() { if let Some(RenderPassColorAttachment { view: view_id, + depth_slice, resolve_target, load_op, store_op, @@ -1438,6 +1442,7 @@ impl Global { .color_attachments .push(Some(ArcRenderPassColorAttachment { view, + depth_slice: *depth_slice, resolve_target, load_op: *load_op, store_op: *store_op, diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 66eef13a7..7302fa068 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -708,6 +708,7 @@ impl Example { view: &surface_tex_view, usage: wgpu_types::TextureUses::COLOR_TARGET, }, + depth_slice: None, resolve_target: None, ops: hal::AttachmentOps::STORE, clear_value: wgpu_types::Color { diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index 5215a4282..3d76cf22e 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -323,6 +323,7 @@ fn fill_screen(exposed: &hal::ExposedAdapter, width: u32, height view: &view, usage: wgpu_types::TextureUses::COLOR_TARGET, }, + depth_slice: None, resolve_target: None, ops: hal::AttachmentOps::STORE, clear_value: wgpu_types::Color::BLUE, diff --git a/wgpu-hal/src/dynamic/command.rs b/wgpu-hal/src/dynamic/command.rs index a33930262..819cc0694 100644 --- a/wgpu-hal/src/dynamic/command.rs +++ b/wgpu-hal/src/dynamic/command.rs @@ -730,6 +730,7 @@ impl<'a> ColorAttachment<'a, dyn DynTextureView> { pub fn expect_downcast(&self) -> ColorAttachment<'a, B> { ColorAttachment { target: self.target.expect_downcast(), + depth_slice: self.depth_slice, resolve_target: self.resolve_target.as_ref().map(|rt| rt.expect_downcast()), ops: self.ops, clear_value: self.clear_value, diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 7618b0ea3..d4faea178 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -2336,6 +2336,7 @@ pub struct Attachment<'a, T: DynTextureView + ?Sized> { #[derive(Clone, Debug)] pub struct ColorAttachment<'a, T: DynTextureView + ?Sized> { pub target: Attachment<'a, T>, + pub depth_slice: Option, pub resolve_target: Option>, pub ops: AttachmentOps, pub clear_value: wgt::Color, diff --git a/wgpu/src/api/render_pass.rs b/wgpu/src/api/render_pass.rs index a9a576c1a..5e150d72a 100644 --- a/wgpu/src/api/render_pass.rs +++ b/wgpu/src/api/render_pass.rs @@ -522,6 +522,8 @@ static_assertions::assert_impl_all!(RenderPassTimestampWrites<'_>: Send, Sync); pub struct RenderPassColorAttachment<'tex> { /// The view to use as an attachment. pub view: &'tex TextureView, + /// The depth slice index of a 3D view. It must not be provided if the view is not 3D. + pub depth_slice: Option, /// The view that will receive the resolved output if multisampling is used. /// /// If set, it is always written to, regardless of how [`Self::ops`] is configured. diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index 31119ef46..2c28df9fb 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -2348,6 +2348,7 @@ impl dispatch::CommandEncoderInterface for CoreCommandEncoder { ca.as_ref() .map(|at| wgc::command::RenderPassColorAttachment { view: at.view.inner.as_core().id, + depth_slice: at.depth_slice, resolve_target: at.resolve_target.map(|view| view.inner.as_core().id), load_op: at.ops.load, store_op: at.ops.store, diff --git a/wgpu/src/util/texture_blitter.rs b/wgpu/src/util/texture_blitter.rs index 2ee6c85d5..e6b46e028 100644 --- a/wgpu/src/util/texture_blitter.rs +++ b/wgpu/src/util/texture_blitter.rs @@ -199,6 +199,7 @@ impl TextureBlitter { label: Some("wgpu::util::TextureBlitter::pass"), color_attachments: &[Some(crate::RenderPassColorAttachment { view: target, + depth_slice: None, resolve_target: None, ops: wgt::Operations { load: LoadOp::Load,