diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index ee0c954b61..2c38f1e456 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -263,11 +263,9 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::BLACK, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/capture/main.rs b/wgpu/examples/capture/main.rs index 136ce424ac..41e0f9a595 100644 --- a/wgpu/examples/capture/main.rs +++ b/wgpu/examples/capture/main.rs @@ -86,11 +86,9 @@ async fn run() { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &texture.create_default_view(), resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::RED, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::RED), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index e5ac3b9cd7..26e57a38da 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -326,16 +326,14 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color { + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { r: 0.1, g: 0.2, b: 0.3, a: 1.0, - }, - read_only: false, + }), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index 478ea6ca14..02829521e0 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -114,11 +114,9 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu:: color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::GREEN, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index cce3d25898..da2c634907 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -186,11 +186,9 @@ impl Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &views[target_mip], resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::WHITE, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::WHITE), + store: true, }, }], depth_stencil_attachment: None, @@ -411,20 +409,19 @@ impl framework::Example for Example { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); { + let clear_color = wgpu::Color { + r: 0.1, + g: 0.2, + b: 0.3, + a: 1.0, + }; let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color { - r: 0.1, - g: 0.2, - b: 0.3, - a: 1.0, - }, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(clear_color), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/msaa-line/main.rs b/wgpu/examples/msaa-line/main.rs index e0728ea63e..482e74a9fe 100644 --- a/wgpu/examples/msaa-line/main.rs +++ b/wgpu/examples/msaa-line/main.rs @@ -255,23 +255,21 @@ impl framework::Example for Example { let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); { - let channel = wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::BLACK, - read_only: false, + let ops = wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), + store: true, }; let rpass_color_attachment = if self.sample_count == 1 { wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel, + ops, } } else { wgpu::RenderPassColorAttachmentDescriptor { attachment: &self.multisampled_framebuffer, resolve_target: Some(&frame.view), - channel, + ops, } }; diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index 59778c3873..c243e870aa 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -756,18 +756,11 @@ impl framework::Example for Example { color_attachments: &[], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &light.target_view, - depth: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: 1.0, - read_only: false, - }, - stencil: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: 0, - read_only: false, - }, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: true, + }), + stencil_ops: None, }), }); pass.set_pipeline(&self.shadow_pass.pipeline); @@ -787,32 +780,23 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color { + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { r: 0.1, g: 0.2, b: 0.3, a: 1.0, - }, - read_only: false, + }), + store: true, }, }], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &self.forward_depth, - depth: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Clear, - clear_value: 1.0, - read_only: false, - }, - stencil: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Clear, - clear_value: 0, - read_only: false, - }, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: false, + }), + stencil_ops: None, }), }); pass.set_pipeline(&self.forward_pass.pipeline); diff --git a/wgpu/examples/skybox/main.rs b/wgpu/examples/skybox/main.rs index 24612e0596..05cb66bfba 100644 --- a/wgpu/examples/skybox/main.rs +++ b/wgpu/examples/skybox/main.rs @@ -278,16 +278,14 @@ impl framework::Example for Skybox { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color { + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { r: 0.1, g: 0.2, b: 0.3, a: 1.0, - }, - read_only: false, + }), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/texture-arrays/main.rs b/wgpu/examples/texture-arrays/main.rs index 849cbde96e..ce9b1b716c 100644 --- a/wgpu/examples/texture-arrays/main.rs +++ b/wgpu/examples/texture-arrays/main.rs @@ -371,11 +371,9 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: wgpu::Color::BLACK, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), + store: true, }, }], depth_stencil_attachment: None, diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index 7123ba3a0c..b280e248b0 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -719,29 +719,20 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &self.reflect_view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: back_color, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(back_color), + store: true, }, }], // We still need to use the depth buffer here // since the pipeline requires it. depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &self.depth_buffer, - depth: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Clear, - clear_value: 1.0, - read_only: false, - }, - stencil: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Clear, - clear_value: 0, - read_only: false, - }, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: true, + }), + stencil_ops: None, }), }); rpass.set_pipeline(&self.terrain_pipeline); @@ -756,27 +747,18 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: back_color, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(back_color), + store: true, }, }], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &self.depth_buffer, - depth: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: 1.0, - read_only: false, - }, - stencil: wgpu::PassChannel { - load_op: wgpu::LoadOp::Clear, - store_op: wgpu::StoreOp::Store, - clear_value: 0, - read_only: false, - }, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: true, + }), + stencil_ops: None, }), }); rpass.set_pipeline(&self.terrain_pipeline); @@ -791,27 +773,15 @@ impl framework::Example for Example { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, - channel: wgpu::PassChannel { - load_op: wgpu::LoadOp::Load, - store_op: wgpu::StoreOp::Store, - clear_value: back_color, - read_only: false, + ops: wgpu::Operations { + load: wgpu::LoadOp::Load, + store: true, }, }], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &self.depth_buffer, - depth: wgpu::PassChannel { - load_op: wgpu::LoadOp::Load, - store_op: wgpu::StoreOp::Store, - clear_value: 1.0, - read_only: true, - }, - stencil: wgpu::PassChannel { - load_op: wgpu::LoadOp::Load, - store_op: wgpu::StoreOp::Store, - clear_value: 0, - read_only: false, - }, + depth_ops: None, + stencil_ops: None, }), }); diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 744ca32a96..9d1a48bebf 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -1,9 +1,9 @@ use crate::{ backend::native_gpu_future, BindGroupDescriptor, BindGroupLayoutDescriptor, BindingResource, BufferDescriptor, Capabilities, CommandEncoderDescriptor, ComputePipelineDescriptor, - Extensions, Limits, MapMode, PipelineLayoutDescriptor, RenderPipelineDescriptor, - SamplerDescriptor, ShaderModuleSource, SwapChainStatus, TextureDescriptor, - TextureViewDescriptor, + Extensions, Limits, LoadOp, MapMode, Operations, PipelineLayoutDescriptor, + RenderPipelineDescriptor, SamplerDescriptor, ShaderModuleSource, SwapChainStatus, + TextureDescriptor, TextureViewDescriptor, }; use arrayvec::ArrayVec; @@ -283,6 +283,43 @@ fn map_texture_copy_view(view: crate::TextureCopyView) -> wgc::command::TextureC } } +fn map_pass_channel(ops: Option<&Operations>) -> wgt::PassChannel { + match ops { + Some(&Operations { + load: LoadOp::Clear(clear_value), + store, + }) => wgt::PassChannel { + load_op: wgt::LoadOp::Clear, + store_op: if store { + wgt::StoreOp::Store + } else { + wgt::StoreOp::Clear + }, + clear_value, + read_only: false, + }, + Some(&Operations { + load: LoadOp::Load, + store, + }) => wgt::PassChannel { + load_op: wgt::LoadOp::Load, + store_op: if store { + wgt::StoreOp::Store + } else { + wgt::StoreOp::Clear + }, + clear_value: V::default(), + read_only: false, + }, + None => wgt::PassChannel { + load_op: wgt::LoadOp::Load, + store_op: wgt::StoreOp::Store, + clear_value: V::default(), + read_only: true, + }, + } +} + impl crate::Context for Context { type AdapterId = wgc::id::AdapterId; type DeviceId = wgc::id::DeviceId; @@ -453,7 +490,8 @@ impl crate::Context for Context { bindings: &bindings, }, PhantomData - )).unwrap() + )) + .unwrap() } fn device_create_pipeline_layout( @@ -879,15 +917,15 @@ impl crate::Context for Context { .map(|ca| wgc::command::ColorAttachmentDescriptor { attachment: ca.attachment.id, resolve_target: ca.resolve_target.map(|rt| rt.id), - channel: ca.channel.clone(), + channel: map_pass_channel(Some(&ca.ops)), }) .collect::>(); let depth_stencil = desc.depth_stencil_attachment.as_ref().map(|dsa| { wgc::command::DepthStencilAttachmentDescriptor { attachment: dsa.attachment.id, - depth: dsa.depth.clone(), - stencil: dsa.stencil.clone(), + depth: map_pass_channel(dsa.depth_ops.as_ref()), + stencil: map_pass_channel(dsa.stencil_ops.as_ref()), } }); diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index f6607aa98e..6b73621252 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -1,6 +1,6 @@ use crate::{ BindGroupDescriptor, BindGroupLayoutDescriptor, BindingResource, BindingType, BufferDescriptor, - CommandEncoderDescriptor, ComputePipelineDescriptor, PipelineLayoutDescriptor, + CommandEncoderDescriptor, ComputePipelineDescriptor, LoadOp, PipelineLayoutDescriptor, ProgrammableStageDescriptor, RenderPipelineDescriptor, SamplerDescriptor, ShaderModuleSource, SwapChainStatus, TextureDescriptor, TextureViewDescriptor, TextureViewDimension, }; @@ -190,11 +190,11 @@ impl crate::RenderPassInner for RenderPass { self.0.set_stencil_reference(reference); } - fn insert_debug_marker(&mut self, label: &str) { + fn insert_debug_marker(&mut self, _label: &str) { unimplemented!() } - fn push_debug_group(&mut self, group_label: &str) { + fn push_debug_group(&mut self, _group_label: &str) { unimplemented!() } @@ -202,7 +202,7 @@ impl crate::RenderPassInner for RenderPass { unimplemented!() } - fn execute_bundles<'a, I: Iterator>(&mut self, render_bundles: I) { + fn execute_bundles<'a, I: Iterator>(&mut self, _render_bundles: I) { unimplemented!() } } @@ -563,10 +563,11 @@ fn map_color(color: wgt::Color) -> web_sys::GpuColorDict { web_sys::GpuColorDict::new(color.a, color.b, color.g, color.r) } -fn map_store_op(op: wgt::StoreOp) -> web_sys::GpuStoreOp { - match op { - wgt::StoreOp::Clear => web_sys::GpuStoreOp::Clear, - wgt::StoreOp::Store => web_sys::GpuStoreOp::Store, +fn map_store_op(store: bool) -> web_sys::GpuStoreOp { + if store { + web_sys::GpuStoreOp::Store + } else { + web_sys::GpuStoreOp::Clear } } @@ -783,7 +784,7 @@ impl crate::Context for Context { ShaderModuleSource::SpirV(spv) => { web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(spv)) } - ShaderModuleSource::Wgsl(code) => { + ShaderModuleSource::Wgsl(_code) => { panic!("WGSL is not yet supported by the Web backend") } }; @@ -1291,13 +1292,9 @@ impl crate::Context for Context { let mut mapped_color_attachment = web_sys::GpuRenderPassColorAttachmentDescriptor::new( &ca.attachment.id.0, - &match ca.channel.load_op { - wgt::LoadOp::Clear => { - wasm_bindgen::JsValue::from(map_color(ca.channel.clear_value)) - } - wgt::LoadOp::Load => { - wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load) - } + &match ca.ops.load { + LoadOp::Clear(color) => wasm_bindgen::JsValue::from(map_color(color)), + LoadOp::Load => wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), }, ); @@ -1305,7 +1302,7 @@ impl crate::Context for Context { mapped_color_attachment.resolve_target(&rt.id.0); } - mapped_color_attachment.store_op(map_store_op(ca.channel.store_op)); + mapped_color_attachment.store_op(map_store_op(ca.ops.store)); mapped_color_attachment }) @@ -1316,19 +1313,39 @@ impl crate::Context for Context { // TODO: label if let Some(dsa) = &desc.depth_stencil_attachment { + let (depth_load_op, depth_store_op) = match dsa.depth_ops { + Some(ref ops) => { + let load_op = match ops.load { + LoadOp::Clear(value) => wasm_bindgen::JsValue::from(value), + LoadOp::Load => wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), + }; + (load_op, map_store_op(ops.store)) + } + None => ( + wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), + web_sys::GpuStoreOp::Store, + ), + }; + let (stencil_load_op, stencil_store_op) = match dsa.depth_ops { + Some(ref ops) => { + let load_op = match ops.load { + LoadOp::Clear(value) => wasm_bindgen::JsValue::from(value), + LoadOp::Load => wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), + }; + (load_op, map_store_op(ops.store)) + } + None => ( + wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), + web_sys::GpuStoreOp::Store, + ), + }; let mapped_depth_stencil_attachment = web_sys::GpuRenderPassDepthStencilAttachmentDescriptor::new( &dsa.attachment.id.0, - &match dsa.depth.load_op { - wgt::LoadOp::Clear => wasm_bindgen::JsValue::from(dsa.depth.clear_value), - wgt::LoadOp::Load => wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), - }, - map_store_op(dsa.depth.store_op), - &match dsa.stencil.load_op { - wgt::LoadOp::Clear => wasm_bindgen::JsValue::from(dsa.stencil.clear_value), - wgt::LoadOp::Load => wasm_bindgen::JsValue::from(web_sys::GpuLoadOp::Load), - }, - map_store_op(dsa.stencil.store_op), + &depth_load_op, + depth_store_op, + &stencil_load_op, + stencil_store_op, ); mapped_desc.depth_stencil_attachment(&mapped_depth_stencil_attachment); diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 9c492894df..87826c449c 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -25,12 +25,12 @@ pub use wgt::{ BlendDescriptor, BlendFactor, BlendOperation, BufferAddress, BufferSize, BufferUsage, Capabilities, Color, ColorStateDescriptor, ColorWrite, CommandBufferDescriptor, CompareFunction, CullMode, DepthStencilStateDescriptor, DeviceDescriptor, DynamicOffset, - Extensions, Extent3d, FilterMode, FrontFace, IndexFormat, InputStepMode, Limits, LoadOp, - Origin3d, PassChannel, PowerPreference, PresentMode, PrimitiveTopology, - RasterizationStateDescriptor, RenderBundleEncoderDescriptor, ShaderLocation, ShaderStage, - StencilOperation, StencilStateFaceDescriptor, StoreOp, SwapChainDescriptor, SwapChainStatus, - TextureAspect, TextureComponentType, TextureDataLayout, TextureDimension, TextureFormat, - TextureUsage, TextureViewDimension, UnsafeExtensions, VertexAttributeDescriptor, VertexFormat, + Extensions, Extent3d, FilterMode, FrontFace, IndexFormat, InputStepMode, Limits, Origin3d, + PowerPreference, PresentMode, PrimitiveTopology, RasterizationStateDescriptor, + RenderBundleEncoderDescriptor, ShaderLocation, ShaderStage, StencilOperation, + StencilStateFaceDescriptor, SwapChainDescriptor, SwapChainStatus, TextureAspect, + TextureComponentType, TextureDataLayout, TextureDimension, TextureFormat, TextureUsage, + TextureViewDimension, UnsafeExtensions, VertexAttributeDescriptor, VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, }; @@ -892,18 +892,39 @@ pub struct ComputePipelineDescriptor<'a> { pub compute_stage: ProgrammableStageDescriptor<'a>, } -// The underlying types are also exported so that documentation shows up for them +/// Operation to perform to the output attachment at the start of a renderpass. +#[derive(Clone, Copy, Debug, Hash, PartialEq)] +pub enum LoadOp { + /// Clear with a specified value. + Clear(V), + /// Load from memory. + Load, +} + +/// Pair of load and store operations for an attachment aspect. +#[derive(Clone, Debug, Hash, PartialEq)] +pub struct Operations { + pub load: LoadOp, + pub store: bool, +} -pub use wgt::RenderPassColorAttachmentDescriptorBase; /// Describes a color attachment to a [`RenderPass`]. -pub type RenderPassColorAttachmentDescriptor<'a> = - wgt::RenderPassColorAttachmentDescriptorBase<&'a TextureView>; -pub use wgt::RenderPassDepthStencilAttachmentDescriptorBase; +#[derive(Clone)] +pub struct RenderPassColorAttachmentDescriptor<'a> { + pub attachment: &'a TextureView, + pub resolve_target: Option<&'a TextureView>, + pub ops: Operations, +} /// Describes a depth/stencil attachment to a [`RenderPass`]. -pub type RenderPassDepthStencilAttachmentDescriptor<'a> = - wgt::RenderPassDepthStencilAttachmentDescriptorBase<&'a TextureView>; +#[derive(Clone)] +pub struct RenderPassDepthStencilAttachmentDescriptor<'a> { + pub attachment: &'a TextureView, + pub depth_ops: Option>, + pub stencil_ops: Option>, +} /// Describes the attachments of a [`RenderPass`]. +#[derive(Clone)] pub struct RenderPassDescriptor<'a, 'b> { /// The color attachments of the render pass. pub color_attachments: &'b [RenderPassColorAttachmentDescriptor<'a>],