mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Web: handle None for depth_ops and stencil_ops (#3660)
This commit is contained in:
parent
c7f3d8d7a3
commit
2c37608ad3
@ -148,6 +148,10 @@ By @cwfitzgerald in [#3610](https://github.com/gfx-rs/wgpu/pull/3610).
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
#### WebGPU
|
||||
|
||||
- Fix handling of `None` values for `depth_ops` and `stencil_ops` in `RenderPassDescriptor::depth_stencil_attachment`. By @niklaskorz in [#3660](https://github.com/gfx-rs/wgpu/pull/3660)
|
||||
|
||||
#### Metal
|
||||
- Fix incorrect mipmap being sampled when using `MinLod <= 0.0` and `MaxLod >= 32.0` or when the fragment shader samples different Lods in the same quad. By @cwfitzgerald in [#3610](https://github.com/gfx-rs/wgpu/pull/3610).
|
||||
|
||||
|
@ -2079,44 +2079,32 @@ impl crate::context::Context for Context {
|
||||
}
|
||||
|
||||
if let Some(dsa) = &desc.depth_stencil_attachment {
|
||||
let mut depth_clear_value = 0.0;
|
||||
let mut stencil_clear_value = 0;
|
||||
let (depth_load_op, depth_store_op) = match dsa.depth_ops {
|
||||
Some(ref ops) => {
|
||||
let load_op = match ops.load {
|
||||
crate::LoadOp::Clear(v) => {
|
||||
depth_clear_value = v;
|
||||
web_sys::GpuLoadOp::Clear
|
||||
}
|
||||
crate::LoadOp::Load => web_sys::GpuLoadOp::Load,
|
||||
};
|
||||
(load_op, map_store_op(ops.store))
|
||||
}
|
||||
None => (web_sys::GpuLoadOp::Load, web_sys::GpuStoreOp::Store),
|
||||
};
|
||||
let (stencil_load_op, stencil_store_op) = match dsa.stencil_ops {
|
||||
Some(ref ops) => {
|
||||
let load_op = match ops.load {
|
||||
crate::LoadOp::Clear(v) => {
|
||||
stencil_clear_value = v;
|
||||
web_sys::GpuLoadOp::Clear
|
||||
}
|
||||
crate::LoadOp::Load => web_sys::GpuLoadOp::Load,
|
||||
};
|
||||
(load_op, map_store_op(ops.store))
|
||||
}
|
||||
None => (web_sys::GpuLoadOp::Load, web_sys::GpuStoreOp::Store),
|
||||
};
|
||||
let mut mapped_depth_stencil_attachment =
|
||||
web_sys::GpuRenderPassDepthStencilAttachment::new(
|
||||
&<<Context as crate::Context>::TextureViewId>::from(dsa.view.id).0,
|
||||
);
|
||||
mapped_depth_stencil_attachment.depth_clear_value(depth_clear_value);
|
||||
mapped_depth_stencil_attachment.depth_load_op(depth_load_op);
|
||||
mapped_depth_stencil_attachment.depth_store_op(depth_store_op);
|
||||
mapped_depth_stencil_attachment.stencil_clear_value(stencil_clear_value);
|
||||
mapped_depth_stencil_attachment.stencil_load_op(stencil_load_op);
|
||||
mapped_depth_stencil_attachment.stencil_store_op(stencil_store_op);
|
||||
if let Some(ref ops) = dsa.depth_ops {
|
||||
let load_op = match ops.load {
|
||||
crate::LoadOp::Clear(v) => {
|
||||
mapped_depth_stencil_attachment.depth_clear_value(v);
|
||||
web_sys::GpuLoadOp::Clear
|
||||
}
|
||||
crate::LoadOp::Load => web_sys::GpuLoadOp::Load,
|
||||
};
|
||||
mapped_depth_stencil_attachment.depth_load_op(load_op);
|
||||
mapped_depth_stencil_attachment.depth_store_op(map_store_op(ops.store));
|
||||
}
|
||||
if let Some(ref ops) = dsa.stencil_ops {
|
||||
let load_op = match ops.load {
|
||||
crate::LoadOp::Clear(v) => {
|
||||
mapped_depth_stencil_attachment.stencil_clear_value(v);
|
||||
web_sys::GpuLoadOp::Clear
|
||||
}
|
||||
crate::LoadOp::Load => web_sys::GpuLoadOp::Load,
|
||||
};
|
||||
mapped_depth_stencil_attachment.stencil_load_op(load_op);
|
||||
mapped_depth_stencil_attachment.stencil_store_op(map_store_op(ops.store));
|
||||
}
|
||||
mapped_desc.depth_stencil_attachment(&mapped_depth_stencil_attachment);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user