mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 06:50:59 +01:00
Validate LoadOp and StoreOp are None for attachments without corresponding depth or stencil aspect (#9567)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
This commit is contained in:
1 parent
a1fceed071
commit
a7e0298dc5
4 files changed
+26
-4
No files matched your search
@@ -191,6 +191,7 @@ By @beholdnec in [#8505](https://github.com/gfx-rs/wgpu/pull/8505).
|
||||
|
||||
- Add clip distances validation for `maxInterStageShaderVariables`. By @ErichDonGubler in [#8762](https://github.com/gfx-rs/wgpu/pull/8762). This may break some existing programs, but it compiles with the WebGPU spec.
|
||||
- Bring immediates in line with webgpu spec. By @atlv24 in [#9280](https://github.com/gfx-rs/wgpu/pull/9280).
|
||||
- Validate `LoadOp` and `StoreOp` are `None` for attachments without corresponding depth or stencil aspect. By @beicause in [#9567](https://github.com/gfx-rs/wgpu/pull/9567).
|
||||
|
||||
#### DX12
|
||||
|
||||
|
||||
+1
-2
@@ -252,8 +252,7 @@ fails-if(dx12) webgpu:api,validation,render_pass,attachment_compatibility:render
|
||||
webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,sample_counts_mismatch:*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:occlusionQuerySet,query_set_type:*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
|
||||
webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:*
|
||||
|
||||
@@ -274,7 +274,7 @@ impl<'ctx> TestCase<'ctx> {
|
||||
depth_stencil_attachment: self.format.is_depth_stencil_format().then_some(
|
||||
RenderPassDepthStencilAttachment {
|
||||
view: &self.texture.create_view(&TextureViewDescriptor::default()),
|
||||
depth_ops: Some(Operations {
|
||||
depth_ops: self.format.has_depth_aspect().then_some(Operations {
|
||||
load: LoadOp::Load,
|
||||
store: StoreOp::Discard,
|
||||
}),
|
||||
@@ -304,7 +304,7 @@ impl<'ctx> TestCase<'ctx> {
|
||||
load: LoadOp::Clear(0.0),
|
||||
store: StoreOp::Store,
|
||||
}),
|
||||
stencil_ops: Some(Operations {
|
||||
stencil_ops: self.format.has_stencil_aspect().then_some(Operations {
|
||||
load: LoadOp::Load,
|
||||
store: StoreOp::Discard,
|
||||
}),
|
||||
|
||||
@@ -806,6 +806,16 @@ pub enum AttachmentError {
|
||||
ReadOnlyWithLoad,
|
||||
#[error("StoreOp must be None for read-only attachments")]
|
||||
ReadOnlyWithStore,
|
||||
#[error("Depth `LoadOp` and `StoreOp` (`{ops:?}`) must be `None` for attachments (`{format:?}`) without depth aspect")]
|
||||
DepthOpsWithoutAspect {
|
||||
format: wgt::TextureFormat,
|
||||
ops: (Option<LoadOp<Option<f32>>>, Option<StoreOp>),
|
||||
},
|
||||
#[error("Stencil `LoadOp` and `StoreOp` (`{ops:?}`) must be `None` for attachments (`{format:?}`) without stencil aspect")]
|
||||
StencilOpsWithoutAspect {
|
||||
format: wgt::TextureFormat,
|
||||
ops: (Option<LoadOp<Option<u32>>>, Option<StoreOp>),
|
||||
},
|
||||
#[error("Attachment without load")]
|
||||
NoLoad,
|
||||
#[error("Attachment without store")]
|
||||
@@ -1849,11 +1859,23 @@ impl Global {
|
||||
Err(AttachmentError::NoClearValue)
|
||||
})?
|
||||
} else {
|
||||
if depth_stencil_attachment.depth.load_op.is_some() || depth_stencil_attachment.depth.store_op.is_some() {
|
||||
return Err(RenderPassErrorInner::InvalidAttachment(AttachmentError::DepthOpsWithoutAspect {
|
||||
format,
|
||||
ops: (depth_stencil_attachment.depth.load_op, depth_stencil_attachment.depth.store_op)
|
||||
}));
|
||||
}
|
||||
ResolvedPassChannel::ReadOnly
|
||||
},
|
||||
stencil: if format.has_stencil_aspect() {
|
||||
depth_stencil_attachment.stencil.resolve(|clear| Ok(clear.unwrap_or_default()))?
|
||||
} else {
|
||||
if depth_stencil_attachment.stencil.load_op.is_some() || depth_stencil_attachment.stencil.store_op.is_some() {
|
||||
return Err(RenderPassErrorInner::InvalidAttachment(AttachmentError::StencilOpsWithoutAspect {
|
||||
format,
|
||||
ops: (depth_stencil_attachment.stencil.load_op, depth_stencil_attachment.stencil.store_op)
|
||||
}));
|
||||
}
|
||||
ResolvedPassChannel::ReadOnly
|
||||
},
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user