mesa: remove DD_TRI_LIGHT_TWOSIDE flag
v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -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_UNFILLED (1 << 2)
|
||||||
#define DD_TRI_STIPPLE (1 << 4)
|
#define DD_TRI_STIPPLE (1 << 4)
|
||||||
#define DD_TRI_OFFSET (1 << 5)
|
#define DD_TRI_OFFSET (1 << 5)
|
||||||
@@ -958,6 +959,8 @@ intelChooseRenderState(struct gl_context * ctx)
|
|||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
struct intel_context *intel = intel_context(ctx);
|
struct intel_context *intel = intel_context(ctx);
|
||||||
GLuint flags = ctx->_TriangleCaps |
|
GLuint flags = ctx->_TriangleCaps |
|
||||||
|
((ctx->Light.Enabled &&
|
||||||
|
ctx->Light.Model.TwoSide) ? DD_TRI_LIGHT_TWOSIDE : 0) |
|
||||||
((ctx->Polygon.FrontMode != GL_FILL ||
|
((ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
|
ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
|
||||||
(ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
|
(ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
|
||||||
|
@@ -241,6 +241,7 @@ void r200ChooseVertexState( struct gl_context *ctx )
|
|||||||
GLuint vap;
|
GLuint vap;
|
||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != 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
|
/* 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
|
* 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);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
r200ContextPtr rmesa = R200_CONTEXT(ctx);
|
r200ContextPtr rmesa = R200_CONTEXT(ctx);
|
||||||
GLuint index = 0;
|
GLuint index = 0;
|
||||||
GLuint flags = ctx->_TriangleCaps;
|
|
||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL);
|
ctx->Polygon.BackMode != GL_FILL);
|
||||||
|
GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
|
||||||
|
|
||||||
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
|
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
|
if (twosided)
|
||||||
if (unfilled) index |= R200_UNFILLED_BIT;
|
index |= R200_TWOSIDE_BIT;
|
||||||
|
if (unfilled)
|
||||||
|
index |= R200_UNFILLED_BIT;
|
||||||
|
|
||||||
if (index != rmesa->radeon.swtcl.RenderIndex) {
|
if (index != rmesa->radeon.swtcl.RenderIndex) {
|
||||||
tnl->Driver.Render.Points = rast_tab[index].points;
|
tnl->Driver.Render.Points = rast_tab[index].points;
|
||||||
|
@@ -275,6 +275,7 @@ void radeonChooseVertexState( struct gl_context *ctx )
|
|||||||
GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT];
|
GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT];
|
||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != 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 |
|
se_coord_fmt &= ~(RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
|
||||||
RADEON_VTX_Z_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 &
|
if ((0 == (tnl->render_inputs_bitset &
|
||||||
(BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)
|
(BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)
|
||||||
| BITFIELD64_BIT(_TNL_ATTRIB_COLOR1))))
|
| BITFIELD64_BIT(_TNL_ATTRIB_COLOR1))))
|
||||||
|| (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
|
|| twosided
|
||||||
|| unfilled) {
|
|| unfilled) {
|
||||||
rmesa->swtcl.needproj = GL_TRUE;
|
rmesa->swtcl.needproj = GL_TRUE;
|
||||||
se_coord_fmt |= (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
|
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);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
r100ContextPtr rmesa = R100_CONTEXT(ctx);
|
r100ContextPtr rmesa = R100_CONTEXT(ctx);
|
||||||
GLuint index = 0;
|
GLuint index = 0;
|
||||||
GLuint flags = ctx->_TriangleCaps;
|
|
||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL);
|
ctx->Polygon.BackMode != GL_FILL);
|
||||||
|
GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
|
||||||
|
|
||||||
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
|
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT;
|
if (twosided)
|
||||||
if (unfilled) index |= RADEON_UNFILLED_BIT;
|
index |= RADEON_TWOSIDE_BIT;
|
||||||
|
if (unfilled)
|
||||||
|
index |= RADEON_UNFILLED_BIT;
|
||||||
|
|
||||||
if (index != rmesa->radeon.swtcl.RenderIndex) {
|
if (index != rmesa->radeon.swtcl.RenderIndex) {
|
||||||
tnl->Driver.Render.Points = rast_tab[index].points;
|
tnl->Driver.Render.Points = rast_tab[index].points;
|
||||||
|
@@ -96,18 +96,6 @@ _mesa_print_state( const char *msg, GLuint state )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
_mesa_print_tri_caps( const char *name, GLuint flags )
|
|
||||||
{
|
|
||||||
_mesa_debug(NULL,
|
|
||||||
"%s: (0x%x) %s\n",
|
|
||||||
name,
|
|
||||||
flags,
|
|
||||||
(flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : ""
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print information about this Mesa version and build options.
|
* Print information about this Mesa version and build options.
|
||||||
*/
|
*/
|
||||||
|
@@ -42,7 +42,6 @@
|
|||||||
struct gl_context;
|
struct gl_context;
|
||||||
struct gl_texture_image;
|
struct gl_texture_image;
|
||||||
|
|
||||||
extern void _mesa_print_tri_caps( const char *name, GLuint flags );
|
|
||||||
extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
|
extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
|
||||||
extern void _mesa_print_state( const char *msg, GLuint state );
|
extern void _mesa_print_state( const char *msg, GLuint state );
|
||||||
extern void _mesa_print_info( void );
|
extern void _mesa_print_info( void );
|
||||||
|
@@ -419,10 +419,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||||
ctx->Light.Enabled = state;
|
ctx->Light.Enabled = state;
|
||||||
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
|
||||||
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
|
||||||
else
|
|
||||||
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
|
||||||
break;
|
break;
|
||||||
case GL_LINE_SMOOTH:
|
case GL_LINE_SMOOTH:
|
||||||
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
|
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
|
||||||
|
@@ -474,10 +474,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
|||||||
return;
|
return;
|
||||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||||
ctx->Light.Model.TwoSide = newbool;
|
ctx->Light.Model.TwoSide = newbool;
|
||||||
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
|
||||||
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
|
||||||
else
|
|
||||||
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
|
||||||
break;
|
break;
|
||||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||||
if (ctx->API != API_OPENGL_COMPAT)
|
if (ctx->API != API_OPENGL_COMPAT)
|
||||||
|
@@ -3161,16 +3161,6 @@ struct gl_matrix_stack
|
|||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \name A bunch of flags that we think might be useful to drivers.
|
|
||||||
*
|
|
||||||
* Set in the __struct gl_contextRec::_TriangleCaps bitfield.
|
|
||||||
*/
|
|
||||||
/*@{*/
|
|
||||||
#define DD_TRI_LIGHT_TWOSIDE (1 << 1)
|
|
||||||
/*@}*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composite state flags
|
* Composite state flags
|
||||||
*/
|
*/
|
||||||
|
@@ -314,27 +314,6 @@ update_twoside(struct gl_context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the ctx->_TriangleCaps bitfield.
|
|
||||||
* XXX that bitfield should really go away someday!
|
|
||||||
* This function must be called after other update_*() functions since
|
|
||||||
* there are dependencies on some other derived values.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
update_tricaps(struct gl_context *ctx, GLbitfield new_state)
|
|
||||||
{
|
|
||||||
ctx->_TriangleCaps = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lighting and shading
|
|
||||||
*/
|
|
||||||
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
|
||||||
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute derived GL state.
|
* Compute derived GL state.
|
||||||
* If __struct gl_contextRec::NewState is non-zero then this function \b must
|
* If __struct gl_contextRec::NewState is non-zero then this function \b must
|
||||||
@@ -411,12 +390,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
|||||||
if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS))
|
if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS))
|
||||||
update_multisample( ctx );
|
update_multisample( ctx );
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
|
|
||||||
| _NEW_STENCIL | _MESA_NEW_SEPARATE_SPECULAR))
|
|
||||||
update_tricaps( ctx, new_state );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ctx->_NeedEyeCoords is now up to date.
|
/* ctx->_NeedEyeCoords is now up to date.
|
||||||
*
|
*
|
||||||
* If the truth value of this variable has changed, update for the
|
* If the truth value of this variable has changed, update for the
|
||||||
|
@@ -158,9 +158,9 @@ static void choose_interp_func( struct gl_context *ctx,
|
|||||||
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
|
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
|
||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL);
|
ctx->Polygon.BackMode != GL_FILL);
|
||||||
if (vtx->need_extras &&
|
GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
|
||||||
((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE) ||
|
|
||||||
unfilled))) {
|
if (vtx->need_extras && (twosided || unfilled)) {
|
||||||
vtx->interp = _tnl_generic_interp_extras;
|
vtx->interp = _tnl_generic_interp_extras;
|
||||||
} else {
|
} else {
|
||||||
vtx->interp = _tnl_generic_interp;
|
vtx->interp = _tnl_generic_interp;
|
||||||
@@ -176,9 +176,9 @@ static void choose_copy_pv_func( struct gl_context *ctx, GLuint edst, GLuint es
|
|||||||
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
|
||||||
ctx->Polygon.BackMode != GL_FILL);
|
ctx->Polygon.BackMode != GL_FILL);
|
||||||
|
|
||||||
if (vtx->need_extras &&
|
GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
|
||||||
((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE) ||
|
|
||||||
unfilled))) {
|
if (vtx->need_extras && (twosided || unfilled)) {
|
||||||
vtx->copy_pv = _tnl_generic_copy_pv_extras;
|
vtx->copy_pv = _tnl_generic_copy_pv_extras;
|
||||||
} else {
|
} else {
|
||||||
vtx->copy_pv = _tnl_generic_copy_pv;
|
vtx->copy_pv = _tnl_generic_copy_pv;
|
||||||
|
Reference in New Issue
Block a user