Set depth clear value to 0 if it is unused (load op load)

VVL complains if it is NaN (the default value)

Fixed: dawn:1718
Include-Ci-Only-Tests: true
Change-Id: I397ad15dc7d5c142d7bd29f4301de27331aa7141
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124820
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
This commit is contained in:
Austin Eng 2023-03-20 22:37:17 +00:00 committed by Dawn LUCI CQ
parent 0e22bdbae7
commit 9a73375ddd
1 changed files with 12 additions and 2 deletions

View File

@ -890,8 +890,18 @@ Ref<RenderPassEncoder> CommandEncoder::BeginRenderPass(const RenderPassDescripto
cmd->depthStencilAttachment.view = view;
switch (descriptor->depthStencilAttachment->depthLoadOp) {
case wgpu::LoadOp::Clear:
cmd->depthStencilAttachment.clearDepth =
descriptor->depthStencilAttachment->depthClearValue;
break;
case wgpu::LoadOp::Load:
case wgpu::LoadOp::Undefined:
// Set depthClearValue to 0 if it is the load op is not clear.
// The default value NaN may be invalid in the backend.
cmd->depthStencilAttachment.clearDepth = 0.f;
break;
}
cmd->depthStencilAttachment.clearStencil =
descriptor->depthStencilAttachment->stencilClearValue;