vrend: Fixes stencil cleaning issue in OpenGL ES3

Resets stencil buffer write mask to ~0u before glClear().
Fixes many tests which use stencil buffer with increment, decrement or
invert operations. For example:
dEQP-GLES3.functional.fragment_ops.random.18
dEQP-GLES3.functional.fragment_ops.random.25
dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.2
macos/master
Robert Tarasov 7 years ago committed by Dave Airlie
parent 272a8901bd
commit b75e0a1dab
  1. 10
      src/vrend_renderer.c

@ -2470,8 +2470,10 @@ void vrend_clear(struct vrend_context *ctx,
} }
} }
if (buffers & PIPE_CLEAR_STENCIL) if (buffers & PIPE_CLEAR_STENCIL) {
glStencilMask(~0u);
glClearStencil(stencil); glClearStencil(stencil);
}
if (buffers & PIPE_CLEAR_COLOR) { if (buffers & PIPE_CLEAR_COLOR) {
uint32_t mask = 0; uint32_t mask = 0;
@ -2510,6 +2512,12 @@ void vrend_clear(struct vrend_context *ctx,
if (!ctx->sub->dsa_state.depth.writemask) if (!ctx->sub->dsa_state.depth.writemask)
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
/* Restore previous stencil buffer write masks for both front and back faces */
if (buffers & PIPE_CLEAR_STENCIL) {
glStencilMaskSeparate(GL_FRONT, ctx->sub->dsa_state.stencil[0].writemask);
glStencilMaskSeparate(GL_BACK, ctx->sub->dsa_state.stencil[1].writemask);
}
/* Restore previous colormask */ /* Restore previous colormask */
if (buffers & PIPE_CLEAR_COLOR) { if (buffers & PIPE_CLEAR_COLOR) {
if (ctx->sub->hw_blend_state.independent_blend_enable) { if (ctx->sub->hw_blend_state.independent_blend_enable) {

Loading…
Cancel
Save