Skip to content

gl: Fix clip flushing

George Matsumura requested to merge gmmatsumura01/cogl:fix-clip-merge2 into cogl-1.22

Prior to this change, the functions add_stencil_clip_rectangle and add_stencil_clip_silhouette in cogl-clip-stack-gl.c were modifying the modelview and projection matrices with their own one-shot transformations and not setting them back to their original values, causing incorrect rendering if the clip stack and modelview matrices were used in conjunction. This makes it so that the modelview and projection matrix state is flushed after each modification of the clip state, reverting the transforms to the user-specified values.

I was able to find this when testing the cogl backend of cairo, where some test cases in its test suite had primitives simply not being rendered, as they were outside of clip boundaries they would normally be within when not transformed by the modelview matrix.

This passes the cogl conformance tests in the test/ directory without any regressions.

Thanks for looking at this and for any reply. If there is anything I can do to make the process of reviewing my changes easier, please let me know.

Merge request reports