This is because even if the glStencilMask is 0x00 the GL_DECR_WRAP and GL_INCR_WRAP states still works and will modify the stencil. Fix T73046 Overlapping parts of wireframes don't render at all in workench with shadows turned on.