i965/gen6+: Respect the VERTEX_PROGRAM_TWO_SIDE flag for shaders.
authorEric Anholt <eric@anholt.net>
Thu, 8 Sep 2011 22:29:02 +0000 (15:29 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 21 Sep 2011 16:46:39 +0000 (09:46 -0700)
Fixes piglit:
vertex-program-two-side enabled front back front2 back2
vertex-program-two-side enabled front back
vertex-program-two-side enabled front2 back2

src/mesa/drivers/dri/i965/brw_vs_constval.c
src/mesa/drivers/dri/i965/gen6_sf_state.c
src/mesa/drivers/dri/i965/gen7_sf_state.c

index 67af23ec4396740b459e72ac207cdf240cb67b80..4d1c4e03850ffa2db86d4e21ee84322b6e21f90f 100644 (file)
@@ -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
    },
index 4a9c0943c65ee95aae05ec18cc894d5f9951cbe0..bb8bc835d3d98f06a5b01ebe92316b67e98a16e7 100644 (file)
@@ -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 |
index af98041c6a126c396b3d68951cc830d99d7d3a97..85d2d87313e49f722ce04a194245e2fe69dc07a5 100644 (file)
@@ -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 |