gallium: adapt state trackers to stencil ref change
authorRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 17:46:43 +0000 (18:46 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 17:46:43 +0000 (18:46 +0100)
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/retrace/interpreter.py
src/gallium/state_trackers/vega/polygon.c

index ce893dad4530e0922ae185caebebd74531b3233f..3f36ccb6217a5918b373112af78803d23cb98a8e 100644 (file)
@@ -130,11 +130,15 @@ struct st_context {
    /*
     * Parameter-like state (or properties)
     */
-   
+
    void set_blend_color(const struct pipe_blend_color *state ) {
       cso_set_blend_color($self->cso, state);
    }
 
+   void set_stencil_ref(const struct pipe_stencil_ref *state ) {
+      cso_set_stencil_ref($self->cso, state);
+   }
+
    void set_clip(const struct pipe_clip_state *state ) {
       $self->pipe->set_clip_state($self->pipe, state);
    }
index 190db43b082844d23c9ceada2c3f293241e248ee..7277701279c9c86c275dddd6ac46ae76b97ca7b7 100755 (executable)
@@ -430,12 +430,15 @@ class Context(Object):
 
     def delete_fs_state(self, state):
         pass
-    
+
     delete_vs_state = delete_fs_state
-    
+
     def set_blend_color(self, state):
         self.real.set_blend_color(state)
 
+    def set_stencil_ref(self, state):
+        self.real.set_stencil_ref(state)
+
     def set_clip_state(self, state):
         _state = gallium.Clip()
         _state.nr = state.nr
index f56ea0c8b44619d9e1bc12a1aa00bd2f40b729da..c06dbf52069be78348a35eef7c6e794bee5dd524 100644 (file)
@@ -307,6 +307,7 @@ static void draw_polygon(struct vg_context *ctx,
 void polygon_fill(struct polygon *poly, struct vg_context *ctx)
 {
    struct pipe_depth_stencil_alpha_state dsa;
+   struct pipe_stencil_ref sr;
    struct pipe_blend_state blend;
    VGfloat bounds[4];
    VGfloat min_x, min_y, max_x, max_y;
@@ -325,6 +326,9 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
    set_blend_for_fill(&blend);
 
    memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
+   memset(&sr, 0, sizeof(struct pipe_stencil_ref));
+   /* only need a fixed 0. Rely on default or move it out at least? */
+   cso_set_stencil_ref(ctx->cso_context, &sr);
 
    cso_save_blend(ctx->cso_context);
    cso_save_depth_stencil_alpha(ctx->cso_context);
@@ -336,7 +340,6 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
       dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
       dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT;
       dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-      dsa.stencil[0].ref_value = 0;
       dsa.stencil[0].valuemask = ~0;
 
       cso_set_blend(ctx->cso_context, &blend);
@@ -352,7 +355,6 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
          dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
          dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
          dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].ref_value = 0;
          dsa.stencil[0].valuemask = ~0;
 
          /* back */
@@ -362,7 +364,6 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
          dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP;
          dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
          dsa.stencil[1].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[1].ref_value = 0;
          dsa.stencil[1].valuemask = ~0;
 
          cso_set_blend(ctx->cso_context, &blend);
@@ -375,7 +376,6 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
 
          cso_save_rasterizer(ctx->cso_context);
          dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].ref_value = 0;
          dsa.stencil[0].valuemask = ~0;
 
          raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH;
@@ -407,7 +407,6 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
    dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
    dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
    dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].ref_value = 0;
    dsa.stencil[0].valuemask = dsa.stencil[0].writemask;
    dsa.stencil[1].enabled = 0;
    memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth,
@@ -425,6 +424,7 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
 {
    struct array *polys = polyarray->array;
    struct pipe_depth_stencil_alpha_state dsa;
+   struct pipe_stencil_ref sr;
    struct pipe_blend_state blend;
    VGfloat min_x = polyarray->min_x;
    VGfloat min_y = polyarray->min_y;
@@ -442,6 +442,9 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
    set_blend_for_fill(&blend);
 
    memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
+   memset(&sr, 0, sizeof(struct pipe_stencil_ref));
+   /* only need a fixed 0. Rely on default or move it out at least? */
+   cso_set_stencil_ref(ctx->cso_context, &sr);
 
    cso_save_blend(ctx->cso_context);
    cso_save_depth_stencil_alpha(ctx->cso_context);
@@ -453,7 +456,6 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
       dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
       dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT;
       dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-      dsa.stencil[0].ref_value = 0;
       dsa.stencil[0].valuemask = ~0;
 
       cso_set_blend(ctx->cso_context, &blend);
@@ -472,7 +474,6 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
          dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
          dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
          dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].ref_value = 0;
          dsa.stencil[0].valuemask = ~0;
 
          /* back */
@@ -482,7 +483,6 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
          dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP;
          dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
          dsa.stencil[1].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[1].ref_value = 0;
          dsa.stencil[1].valuemask = ~0;
 
          cso_set_blend(ctx->cso_context, &blend);
@@ -498,7 +498,6 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
 
          cso_save_rasterizer(ctx->cso_context);
          dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].ref_value = 0;
          dsa.stencil[0].valuemask = ~0;
 
          raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH;
@@ -536,7 +535,6 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
    dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
    dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
    dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].ref_value = 0;
    dsa.stencil[0].valuemask = dsa.stencil[0].writemask;
    dsa.stencil[1].enabled = 0;
    memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth,