Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f4b3d6b

Browse files
SenorBlancoSkia Commit-Bot
authored andcommitted
Dawn: fix single-sided stencil.
GrStencilSettings requires that single-sided stencil be accessed via frontAndBack(), not via front() or back(). Change-Id: Ib35e6187bda05e21c164685f7b726ce4849979fe Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249416 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
1 parent b80d31f commit f4b3d6b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/gpu/dawn/GrDawnProgramBuilder.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,18 @@ static dawn::DepthStencilStateDescriptor create_depth_stencil_state(
241241
dawn::DepthStencilStateDescriptor state;
242242
state.format = depthStencilFormat;
243243
if (!stencilSettings.isDisabled()) {
244-
const GrStencilSettings::Face& front = stencilSettings.front(origin);
245-
state.stencilReadMask = front.fTestMask;
246-
state.stencilWriteMask = front.fWriteMask;
247-
state.stencilFront = to_stencil_state_face(stencilSettings.front(origin));
248244
if (stencilSettings.isTwoSided()) {
249-
state.stencilBack = to_stencil_state_face(stencilSettings.back(origin));
245+
auto front = stencilSettings.front(origin);
246+
auto back = stencilSettings.front(origin);
247+
state.stencilFront = to_stencil_state_face(front);
248+
state.stencilBack = to_stencil_state_face(back);
249+
state.stencilReadMask = front.fTestMask;
250+
state.stencilWriteMask = front.fWriteMask;
250251
} else {
251-
state.stencilBack = state.stencilFront;
252+
auto frontAndBack = stencilSettings.frontAndBack();
253+
state.stencilBack = state.stencilFront = to_stencil_state_face(frontAndBack);
254+
state.stencilReadMask = frontAndBack.fTestMask;
255+
state.stencilWriteMask = frontAndBack.fWriteMask;
252256
}
253257
}
254258
return state;

0 commit comments

Comments
 (0)