But I feel glStencilMask is not working on an app to test stencil.
Could you check this is a bug or known issue or some misunderstanding?
*Environment
Raspberry PI 3
Mesa 12.0.2
DRI - vc4_dri
* Symptom
Stencil buffer is updated by glStencilOp(GL_INVERT, GL_KEEP, GL_KEEP) even after glStencilMask(0x0).
(I'm not quite sure that this is normal behaviour, but I feel it shouldn't as it didn't on other device.)
* Code
Code: Select all
...
glStencilFunc(GL_EQUAL, 0x2, 0x1);
glStencilOp(GL_INVERT, GL_KEEP, GL_KEEP);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[3]);
...
// Save stencil mask
GLint stencilMask;
glGetIntegerv(GL_STENCIL_WRITEMASK, &stencilMask);
glStencilMask(0x0);
for (i = 0; i < NumTests; ++i)
{
glStencilFunc(GL_EQUAL, stencilValues[i], 0xff);
glUniform4fv(colorLoc, 1, colors[i]);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[4]);
}
// Restore stencil mask
glStencilMask(stencilMask);
SDL_GL_SwapWindow(window);
Seems stencil buffer is updated after first draw call in loop.
So the second call shows unexpected result.