From 447c488d77ea9710e0ffc238953917189d3000c7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 8 Sep 2011 15:29:02 -0700 Subject: [PATCH] i965/gen6+: Respect the VERTEX_PROGRAM_TWO_SIDE flag for shaders. 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 | 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 67af23ec439..4d1c4e03850 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 4a9c0943c65..bb8bc835d3d 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 af98041c6a1..85d2d87313e 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 | -- 2.30.2