Skip to content

WIP: cogl/clip-stack-gl: Allow writing to two bits of the stencil buffer

Daniel van Vugt requested to merge vanvugt/mutter:fix-stencil-mask into master

The old mask of 0x1 meant that the if (merge) code paths did not work because stencil buffer entries would be limited to:

   GL_INCR(old value) & 0x1 <= 0x1

So then the GL_DECR step would always result in every stencil entry becoming zero. The stencil buffer was left always empty when merge == TRUE and didn't stencil anything. The good news is it was hard to notice this bug because the if (!rect->can_be_scissor) optimization was causing us to skip the broken code in most cases.

Using a mask of 0x3 is sufficient because we only ever GL_INCR up to a maximum value of 2. So now GL_DECR can actually result in some values being non-zero.

Edited by Daniel van Vugt

Merge request reports