diff options
author | Brian Paul <[email protected]> | 2013-04-17 11:58:33 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-04-17 11:59:42 -0600 |
commit | cbbcb0247e6aa8d7adc274a94206ee02f9c70bea (patch) | |
tree | 368c41d00e04bdd4e021acee570257f06e873ddd /src/mesa/drivers | |
parent | c9bb052e31b7952272e60d28969e90eafb6b3e1f (diff) |
mesa: remove DD_TRI_LIGHT_TWOSIDE flag
v2: use conditional operator instead of bit shifting
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_tris.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_swtcl.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_swtcl.c | 11 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 9a9c56f3eea..07c73f58519 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -943,6 +943,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint /**********************************************************************/ +#define DD_TRI_LIGHT_TWOSIDE (1 << 1) #define DD_TRI_UNFILLED (1 << 2) #define DD_TRI_STIPPLE (1 << 4) #define DD_TRI_OFFSET (1 << 5) @@ -958,6 +959,8 @@ intelChooseRenderState(struct gl_context * ctx) TNLcontext *tnl = TNL_CONTEXT(ctx); struct intel_context *intel = intel_context(ctx); GLuint flags = ctx->_TriangleCaps | + ((ctx->Light.Enabled && + ctx->Light.Model.TwoSide) ? DD_TRI_LIGHT_TWOSIDE : 0) | ((ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) | (ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) | diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index fb92e751a1b..274e3386b4a 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -241,6 +241,7 @@ void r200ChooseVertexState( struct gl_context *ctx ) GLuint vap; GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL); + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; /* We must ensure that we don't do _tnl_need_projected_coords while in a * rasterization fallback. As this function will be called again when we @@ -573,15 +574,17 @@ void r200ChooseRenderState( struct gl_context *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint index = 0; - GLuint flags = ctx->_TriangleCaps; GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL); + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback) return; - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT; - if (unfilled) index |= R200_UNFILLED_BIT; + if (twosided) + index |= R200_TWOSIDE_BIT; + if (unfilled) + index |= R200_UNFILLED_BIT; if (index != rmesa->radeon.swtcl.RenderIndex) { tnl->Driver.Render.Points = rast_tab[index].points; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index ed452df3f79..1e801627183 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -275,6 +275,7 @@ void radeonChooseVertexState( struct gl_context *ctx ) GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT]; GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL); + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; se_coord_fmt &= ~(RADEON_VTX_XY_PRE_MULT_1_OVER_W0 | RADEON_VTX_Z_PRE_MULT_1_OVER_W0 | @@ -294,7 +295,7 @@ void radeonChooseVertexState( struct gl_context *ctx ) if ((0 == (tnl->render_inputs_bitset & (BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX) | BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)))) - || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) + || twosided || unfilled) { rmesa->swtcl.needproj = GL_TRUE; se_coord_fmt |= (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 | @@ -696,15 +697,17 @@ void radeonChooseRenderState( struct gl_context *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint index = 0; - GLuint flags = ctx->_TriangleCaps; GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL); + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback) return; - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT; - if (unfilled) index |= RADEON_UNFILLED_BIT; + if (twosided) + index |= RADEON_TWOSIDE_BIT; + if (unfilled) + index |= RADEON_UNFILLED_BIT; if (index != rmesa->radeon.swtcl.RenderIndex) { tnl->Driver.Render.Points = rast_tab[index].points; |