[mutter] cogl/clip-stack: Explicitely initialize the stencil mask



commit 1e0b015ce89894dca1603b2fb5ead8d3c08f7ac8
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Feb 26 17:21:09 2020 +0100

    cogl/clip-stack: Explicitely initialize the stencil mask
    
    We need the stencil buffer to consist of binary values of 0 and 1
    because we're doing additions and subtractions on the buffer, so even
    though this is the default, explicitely set the stencil mask to 0x1.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/1096

 cogl/cogl/driver/gl/cogl-clip-stack-gl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
index 01c97cbc8..4946f8690 100644
--- a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -98,6 +98,7 @@ add_stencil_clip_rectangle (CoglFramebuffer *framebuffer,
   else
     {
       GE( ctx, glEnable (GL_STENCIL_TEST) );
+      GE( ctx, glStencilMask (0x1) );
 
       /* Initially disallow everything */
       GE( ctx, glClearStencil (0) );
@@ -155,8 +156,6 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
                          - framebuffer->viewport_y,
                          0);
 
-  GE( ctx, glEnable (GL_STENCIL_TEST) );
-
   GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) );
   GE( ctx, glDepthMask (FALSE) );
 
@@ -167,6 +166,9 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
     }
   else
     {
+      GE( ctx, glEnable (GL_STENCIL_TEST) );
+      GE( ctx, glStencilMask (0x1) );
+
       /* Initially disallow everything */
       GE( ctx, glClearStencil (0) );
       GE( ctx, glClear (GL_STENCIL_BUFFER_BIT) );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]