Add error context to clarify which depth/stencil function/op is validated

Fixed: dawn:1735
Change-Id: I5e3e3e67bb6fd01c10257a2a8c39ba29b49e0933
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131081
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <toji@google.com>
Kokoro: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2023-05-03 00:51:08 +00:00 committed by Dawn LUCI CQ
parent e89f88b600
commit 5eb3619d3e
1 changed files with 18 additions and 9 deletions

View File

@ -202,15 +202,24 @@ MaybeError ValidateDepthStencilState(const DeviceBase* device,
const DepthStencilState* descriptor) { const DepthStencilState* descriptor) {
DAWN_INVALID_IF(descriptor->nextInChain != nullptr, "nextInChain is not nullptr."); DAWN_INVALID_IF(descriptor->nextInChain != nullptr, "nextInChain is not nullptr.");
DAWN_TRY(ValidateCompareFunction(descriptor->depthCompare)); DAWN_TRY_CONTEXT(ValidateCompareFunction(descriptor->depthCompare),
DAWN_TRY(ValidateCompareFunction(descriptor->stencilFront.compare)); "validating depth compare function");
DAWN_TRY(ValidateStencilOperation(descriptor->stencilFront.failOp)); DAWN_TRY_CONTEXT(ValidateCompareFunction(descriptor->stencilFront.compare),
DAWN_TRY(ValidateStencilOperation(descriptor->stencilFront.depthFailOp)); "validating stencil front compare function");
DAWN_TRY(ValidateStencilOperation(descriptor->stencilFront.passOp)); DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilFront.failOp),
DAWN_TRY(ValidateCompareFunction(descriptor->stencilBack.compare)); "validating stencil front fail operation");
DAWN_TRY(ValidateStencilOperation(descriptor->stencilBack.failOp)); DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilFront.depthFailOp),
DAWN_TRY(ValidateStencilOperation(descriptor->stencilBack.depthFailOp)); "validating stencil front depth fail operation");
DAWN_TRY(ValidateStencilOperation(descriptor->stencilBack.passOp)); DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilFront.passOp),
"validating stencil front pass operation");
DAWN_TRY_CONTEXT(ValidateCompareFunction(descriptor->stencilBack.compare),
"validating stencil back compare function");
DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilBack.failOp),
"validating stencil back fail operation");
DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilBack.depthFailOp),
"validating stencil back depth fail operation");
DAWN_TRY_CONTEXT(ValidateStencilOperation(descriptor->stencilBack.passOp),
"validating stencil back pass operation");
const Format* format; const Format* format;
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(descriptor->format)); DAWN_TRY_ASSIGN(format, device->GetInternalFormat(descriptor->format));