Skip to content

Commit

Permalink
[WebGPU] Using the stencil reference value as the stencil clear value…
Browse files Browse the repository at this point in the history
… fails when the reference value is greater than 255

https://bugs.webkit.org/show_bug.cgi?id=263812
<radar://117610399>

Reviewed by Tadeu Zagallo.

The stencil value is masked to the max value in the stencil buffer.

All of our stencil formats are 8 bits and that is not likely to change
as stencil formats have not changed in more than ten years, so mask with 255.

* LayoutTests/http/tests/webgpu/webgpu/api/operation/render_pass/clear_value-expected.txt:
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::setStencilReference):

Canonical link: https://commits.webkit.org/269957@main
  • Loading branch information
mwyrzykowski committed Oct 30, 2023
1 parent d8097a7 commit c571e2a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
(Populate me when we're ready to investigate this test)

PASS :stored:
PASS :loaded:
PASS :srgb:
PASS :layout:
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true
PASS :stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false

2 changes: 1 addition & 1 deletion Source/WebGPU/WebGPU/RenderPassEncoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@

void RenderPassEncoder::setStencilReference(uint32_t reference)
{
[m_renderCommandEncoder setStencilReferenceValue:reference];
[m_renderCommandEncoder setStencilReferenceValue:(reference & 0xFF)];
}

void RenderPassEncoder::setVertexBuffer(uint32_t slot, const Buffer& buffer, uint64_t offset, uint64_t size)
Expand Down

0 comments on commit c571e2a

Please sign in to comment.