fo: adapt to stencil ref changes
authorRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 20:17:46 +0000 (21:17 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 20:17:46 +0000 (21:17 +0100)
src/gallium/drivers/failover/fo_context.h
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/failover/fo_state_emit.c

index 191a44c3dfc7521ef085d04641a6cb9cc1bb5494..bb1a168ea7aeb4d46c051ea0e1b28b461ca15731 100644 (file)
 #define FO_NEW_VERTEX          0x2000
 #define FO_NEW_VERTEX_SHADER   0x4000
 #define FO_NEW_BLEND_COLOR     0x8000
-#define FO_NEW_CLEAR_COLOR     0x10000
-#define FO_NEW_VERTEX_BUFFER   0x20000
-#define FO_NEW_VERTEX_ELEMENT  0x40000
+#define FO_NEW_STENCIL_REF     0x10000
+#define FO_NEW_CLEAR_COLOR     0x20000
+#define FO_NEW_VERTEX_BUFFER   0x40000
+#define FO_NEW_VERTEX_ELEMENT  0x80000
 
 
 
@@ -79,6 +80,7 @@ struct failover_context {
    const struct fo_state     *vertex_shader;
 
    struct pipe_blend_color blend_color;
+   struct pipe_stencil_ref stencil_ref;
    struct pipe_clip_state clip;
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
index c189d1d82cd3a0cdad16c5e90bdfc3f4e8600ef6..970606a3f50a0cd3561e2e14c7fcaab1fa0b8d6e 100644 (file)
@@ -90,7 +90,7 @@ failover_delete_blend_state( struct pipe_context *pipe,
 
 static void
 failover_set_blend_color( struct pipe_context *pipe,
-                         const struct pipe_blend_color *blend_color )
+                          const struct pipe_blend_color *blend_color )
 {
    struct failover_context *failover = failover_context(pipe);
 
@@ -100,9 +100,21 @@ failover_set_blend_color( struct pipe_context *pipe,
    failover->hw->set_blend_color( failover->hw, blend_color );
 }
 
+static void
+failover_set_stencil_ref( struct pipe_context *pipe,
+                          const struct pipe_stencil_ref *stencil_ref )
+{
+   struct failover_context *failover = failover_context(pipe);
+
+   failover->stencil_ref = *stencil_ref;
+   failover->dirty |= FO_NEW_STENCIL_REF;
+   failover->sw->set_stencil_ref( failover->sw, stencil_ref );
+   failover->hw->set_stencil_ref( failover->hw, stencil_ref );
+}
+
 static void 
 failover_set_clip_state( struct pipe_context *pipe,
-                        const struct pipe_clip_state *clip )
+                         const struct pipe_clip_state *clip )
 {
    struct failover_context *failover = failover_context(pipe);
 
@@ -533,6 +545,7 @@ failover_init_state_functions( struct failover_context *failover )
    failover->pipe.delete_vs_state = failover_delete_vs_state;
 
    failover->pipe.set_blend_color = failover_set_blend_color;
+   failover->pipe.set_stencil_ref = failover_set_stencil_ref;
    failover->pipe.set_clip_state = failover_set_clip_state;
    failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
    failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
index a3341e33f807102fda034fc8f1290e9e8d2fd8a4..5c000808425cdeedfd11271e47e73c541eab57f7 100644 (file)
@@ -65,7 +65,10 @@ failover_state_emit( struct failover_context *failover )
 
    if (failover->dirty & FO_NEW_DEPTH_STENCIL)
       failover->sw->bind_depth_stencil_alpha_state( failover->sw,
-                                                   failover->depth_stencil->sw_state );
+                                                    failover->depth_stencil->sw_state );
+
+   if (failover->dirty & FO_NEW_STENCIL_REF)
+      failover->sw->set_stencil_ref( failover->sw, &failover->stencil_ref );
 
    if (failover->dirty & FO_NEW_FRAMEBUFFER)
       failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer );