[965] Fix and enable separate stencil.
authorEric Anholt <eric@anholt.net>
Fri, 21 Dec 2007 19:39:33 +0000 (11:39 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 21 Dec 2007 19:50:00 +0000 (11:50 -0800)
Note that this does not enable GL_EXT_stencil_two_side, because Mesa's computed
_TestTwoSide ends up respecting only STENCIL_TEST_TWO_SIDE_EXT (defaults to
GL_FALSE), even if the application uses only GL 2.0 / ATI entrypoints.

src/mesa/drivers/dri/i965/brw_cc.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/intel_context.c

index 245d2dd..357704c 100644 (file)
@@ -77,8 +77,8 @@ static void upload_cc_unit( struct brw_context *brw )
       cc.cc1.stencil_write_mask = brw->attribs.Stencil->WriteMask[0];
       cc.cc1.stencil_test_mask = brw->attribs.Stencil->ValueMask[0];
 
-      if (brw->attribs.Stencil->TestTwoSide) {
-        cc.cc0.bf_stencil_enable = brw->attribs.Stencil->TestTwoSide;
+      if (brw->attribs.Stencil->_TestTwoSide) {
+        cc.cc0.bf_stencil_enable = brw->attribs.Stencil->_TestTwoSide;
         cc.cc0.bf_stencil_func = intel_translate_compare_func(brw->attribs.Stencil->Function[1]);
         cc.cc0.bf_stencil_fail_op = intel_translate_stencil_op(brw->attribs.Stencil->FailFunc[1]);
         cc.cc0.bf_stencil_pass_depth_fail_op = intel_translate_stencil_op(brw->attribs.Stencil->ZFailFunc[1]);
@@ -91,7 +91,8 @@ static void upload_cc_unit( struct brw_context *brw )
       /* Not really sure about this:
        */
       if (brw->attribs.Stencil->WriteMask[0] ||
-         (brw->attribs.Stencil->TestTwoSide && brw->attribs.Stencil->WriteMask[1]))
+         (brw->attribs.Stencil->_TestTwoSide &&
+          brw->attribs.Stencil->WriteMask[1]))
         cc.cc0.stencil_write_enable = 1;
    }
 
index 009acc7..2775fad 100644 (file)
@@ -247,7 +247,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
       lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
 
       if (brw->attribs.Stencil->WriteMask[0] ||
-         (brw->attribs.Stencil->TestTwoSide && brw->attribs.Stencil->WriteMask[1]))
+         (brw->attribs.Stencil->_TestTwoSide &&
+          brw->attribs.Stencil->WriteMask[1]))
         lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
    }
 
index d3b0b06..0866c5c 100644 (file)
@@ -89,6 +89,7 @@ int INTEL_DEBUG = (0);
 #define need_GL_EXT_framebuffer_object
 #define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_secondary_color
+#define need_GL_ATI_separate_stencil
 #define need_GL_EXT_point_parameters
 #define need_GL_VERSION_2_0
 #define need_GL_VERSION_2_1
@@ -188,7 +189,14 @@ const struct dri_extension card_extensions[] =
     { "GL_EXT_fog_coord",                  GL_EXT_fog_coord_functions },
     { "GL_EXT_multi_draw_arrays",          GL_EXT_multi_draw_arrays_functions },
     { "GL_EXT_secondary_color",            GL_EXT_secondary_color_functions },
+    { "GL_ATI_separate_stencil",           GL_ATI_separate_stencil_functions },
     { "GL_EXT_stencil_wrap",               NULL },
+    /* Do not enable this extension.  It conflicts with GL_ATI_separate_stencil
+     * and 2.0's separate stencil, because mesa's computed _TestTwoSide will
+     * only reflect whether it's enabled through this extension, even if the
+     * application is using the other interfaces.
+     */
+/*{ "GL_EXT_stencil_two_side",           GL_EXT_stencil_two_side_functions },*/
     { "GL_EXT_texture_edge_clamp",         NULL },
     { "GL_EXT_texture_env_combine",        NULL },
     { "GL_EXT_texture_env_dot3",           NULL },