[Mesa-dev] [PATCH 08/10] i965: Respect the VERTEX_PROGRAM_TWO_SIDE flag for shaders.

Eric Anholt eric at anholt.net
Thu Sep 8 23:32:25 PDT 2011


Fixes piglit:
vertex-program-two-side
vertex-program-two-side primary
vertex-program-two-side secondary
---
 src/mesa/drivers/dri/i965/brw_vs_constval.c |    6 +++---
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |    5 +++--
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |    6 ++----
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index 67af23e..4d1c4e0 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -197,8 +197,8 @@ static void calc_wm_input_sizes( struct brw_context *brw )
 
    memset(&t, 0, sizeof(t));
 
-   /* _NEW_LIGHT */
-   if (ctx->Light.Model.TwoSide)
+   /* _NEW_LIGHT | _NEW_PROGRAM */
+   if (ctx->VertexProgram._TwoSideEnabled)
       t.twoside = 1;
 
    for (i = 0; i < VERT_ATTRIB_MAX; i++) 
@@ -233,7 +233,7 @@ static void calc_wm_input_sizes( struct brw_context *brw )
 
 const struct brw_tracked_state brw_wm_input_sizes = {
    .dirty = {
-      .mesa  = _NEW_LIGHT,
+      .mesa  = _NEW_LIGHT | _NEW_PROGRAM,
       .brw   = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_INPUT_DIMENSIONS,
       .cache = 0
    },
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 4a9c094..bb8bc83 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -115,7 +115,6 @@ upload_sf_state(struct brw_context *brw)
    GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
    int attr = 0, input_index = 0;
    int urb_entry_read_offset;
-   int two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
    float point_size;
    uint16_t attr_overrides[FRAG_ATTRIB_MAX];
    int nr_userclip;
@@ -285,9 +284,10 @@ upload_sf_state(struct brw_context *brw)
        */
       assert(input_index < 16 || attr == input_index);
 
+      /* _NEW_LIGHT | _NEW_PROGRAM */
       attr_overrides[input_index++] =
          get_attr_override(&vue_map, urb_entry_read_offset, attr,
-                           two_side_color);
+                           ctx->VertexProgram._TwoSideEnabled);
    }
 
    for (; input_index < FRAG_ATTRIB_MAX; input_index++)
@@ -315,6 +315,7 @@ upload_sf_state(struct brw_context *brw)
 const struct brw_tracked_state gen6_sf_state = {
    .dirty = {
       .mesa  = (_NEW_LIGHT |
+		_NEW_PROGRAM |
 		_NEW_POLYGON |
 		_NEW_LINE |
 		_NEW_SCISSOR |
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index af98041..85d2d87 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -45,9 +45,6 @@ upload_sbe_state(struct brw_context *brw)
    /* _NEW_TRANSFORM */
    int urb_entry_read_offset = ctx->Transform.ClipPlanesEnabled ? 2 : 1;
    int nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
-
-   /* _NEW_LIGHT */
-   int two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
    uint16_t attr_overrides[FRAG_ATTRIB_MAX];
 
    brw_compute_vue_map(&vue_map, intel, nr_userclip, vs_outputs_written);
@@ -104,7 +101,7 @@ upload_sbe_state(struct brw_context *brw)
 
       attr_overrides[input_index++] =
          get_attr_override(&vue_map, urb_entry_read_offset, attr,
-                           two_side_color);
+                           ctx->VertexProgram._TwoSideEnabled);
    }
 
    for (; attr < FRAG_ATTRIB_MAX; attr++)
@@ -276,6 +273,7 @@ upload_sf_state(struct brw_context *brw)
 const struct brw_tracked_state gen7_sf_state = {
    .dirty = {
       .mesa  = (_NEW_LIGHT |
+		_NEW_PROGRAM |
 		_NEW_POLYGON |
 		_NEW_LINE |
 		_NEW_SCISSOR |
-- 
1.7.5.4



More information about the mesa-dev mailing list