summaryrefslogtreecommitdiff
path: root/ext/webgpu
diff options
context:
space:
mode:
authorchirsz <chirsz@foxmail.com>2024-05-21 04:47:04 +0800
committerGitHub <noreply@github.com>2024-05-20 13:47:04 -0700
commit529356cc120a3b2f7b13131e5a5117b093e11158 (patch)
treee5d4d6a069d8d92fdf17d80e76875205ef0a7669 /ext/webgpu
parentc89f9f9ad1e3d940a460092ee7bc44eb046fa1e1 (diff)
fix(ext/webgpu): Allow `depthClearValue` to be undefined when `depthLoadOp` is not "clear" (#23850)
Diffstat (limited to 'ext/webgpu')
-rw-r--r--ext/webgpu/command_encoder.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/webgpu/command_encoder.rs b/ext/webgpu/command_encoder.rs
index 3d82b77d4..4bee7aac3 100644
--- a/ext/webgpu/command_encoder.rs
+++ b/ext/webgpu/command_encoder.rs
@@ -79,7 +79,7 @@ pub struct GpuRenderPassColorAttachment {
#[serde(rename_all = "camelCase")]
pub struct GpuRenderPassDepthStencilAttachment {
view: ResourceId,
- depth_clear_value: f32,
+ depth_clear_value: Option<f32>,
depth_load_op: Option<wgpu_core::command::LoadOp>,
depth_store_op: Option<wgpu_core::command::StoreOp>,
depth_read_only: bool,
@@ -168,7 +168,9 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
store_op: attachment
.depth_store_op
.unwrap_or(wgpu_core::command::StoreOp::Store),
- clear_value: attachment.depth_clear_value,
+ // In "01_webgpu.js", `depthLoadOp` is cheked to ensure its value is not "clear"
+ // when `depthClearValue` is undefined, so the default 0.0 doesn't matter.
+ clear_value: attachment.depth_clear_value.unwrap_or(0.0),
read_only: attachment.depth_read_only,
},
stencil: wgpu_core::command::PassChannel {