summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-04-16 19:06:22 -0600
committerBrian Paul <brianp@vmware.com>2013-04-17 11:59:41 -0600
commitc9bb052e31b7952272e60d28969e90eafb6b3e1f (patch)
treea30c87f75f8019051f6ccb9085309028e2f29f40
parent56dc53ed5bae2751eeadbfc1d163dfec72e8cfc8 (diff)
mesa: remove DD_TRI_UNFILLED flag
Use alternate code in intel, r200, radeon drivers. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c5
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_swtcl.c14
-rw-r--r--src/mesa/main/debug.c5
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/polygon.c5
-rw-r--r--src/mesa/main/state.c9
-rw-r--r--src/mesa/tnl/t_vertex.c11
10 files changed, 41 insertions, 32 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index e62fd612aa..9a9c56f3ee 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -943,7 +943,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint
/**********************************************************************/
-
+#define DD_TRI_UNFILLED (1 << 2)
#define DD_TRI_STIPPLE (1 << 4)
#define DD_TRI_OFFSET (1 << 5)
#define DD_LINE_STIPPLE (1 << 7)
@@ -958,6 +958,8 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
+ ((ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
(ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
((ctx->Polygon.OffsetPoint ||
ctx->Polygon.OffsetLine ||
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 93ae52a4bb..6f79610f85 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -731,12 +731,13 @@ static void r200PolygonOffset( struct gl_context *ctx,
static void r200PolygonMode( struct gl_context *ctx, GLenum face, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
/* Can't generally do unfilled via tcl, but some good special
* cases work.
*/
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag);
+ TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, unfilled);
if (rmesa->radeon.TclFallback) {
r200ChooseRenderState( ctx );
r200ChooseVertexState( ctx );
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 5c6e276dc9..fb92e751a1 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -239,6 +239,8 @@ void r200ChooseVertexState( struct gl_context *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint vte;
GLuint vap;
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
/* 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
@@ -254,7 +256,8 @@ void r200ChooseVertexState( struct gl_context *ctx )
* bigger one.
*/
if ((0 == (tnl->render_inputs_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)))
- || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
+ || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+ || unfilled) {
rmesa->swtcl.needproj = GL_TRUE;
vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
vte &= ~R200_VTX_W0_FMT;
@@ -571,12 +574,14 @@ void r200ChooseRenderState( struct gl_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);
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
return;
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= R200_UNFILLED_BIT;
+ if (unfilled) index |= R200_UNFILLED_BIT;
if (index != rmesa->radeon.swtcl.RenderIndex) {
tnl->Driver.Render.Points = rast_tab[index].points;
@@ -634,8 +639,11 @@ static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim )
static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
+
rmesa->radeon.swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
+ if (prim < GL_TRIANGLES || !unfilled)
r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) );
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 49e346c88f..2f30f64f2e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -533,12 +533,13 @@ static void radeonPolygonOffset( struct gl_context *ctx,
static void radeonPolygonMode( struct gl_context *ctx, GLenum face, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
/* Can't generally do unfilled via tcl, but some good special
* cases work.
*/
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_UNFILLED, flag);
+ TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_UNFILLED, unfilled);
if (rmesa->radeon.TclFallback) {
radeonChooseRenderState( ctx );
radeonChooseVertexState( ctx );
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index 4f264a63f4..ed452df3f7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -273,6 +273,8 @@ void radeonChooseVertexState( struct gl_context *ctx )
TNLcontext *tnl = TNL_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);
se_coord_fmt &= ~(RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
@@ -292,7 +294,8 @@ 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|DD_TRI_UNFILLED))) {
+ || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+ || unfilled) {
rmesa->swtcl.needproj = GL_TRUE;
se_coord_fmt |= (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_Z_PRE_MULT_1_OVER_W0);
@@ -694,12 +697,14 @@ void radeonChooseRenderState( struct gl_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);
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
return;
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= RADEON_UNFILLED_BIT;
+ if (unfilled) index |= RADEON_UNFILLED_BIT;
if (index != rmesa->radeon.swtcl.RenderIndex) {
tnl->Driver.Render.Points = rast_tab[index].points;
@@ -741,8 +746,11 @@ static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim )
static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
+
rmesa->radeon.swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
+ if (prim < GL_TRIANGLES || !unfilled)
radeonRasterPrimitive( ctx, reduced_hw_prim[prim] );
}
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 418f0e2e6b..e8d850dff8 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,11 +100,10 @@ void
_mesa_print_tri_caps( const char *name, GLuint flags )
{
_mesa_debug(NULL,
- "%s: (0x%x) %s%s\n",
+ "%s: (0x%x) %s\n",
name,
flags,
- (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
- (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : ""
+ (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : ""
);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0463689587..d6c2b35c6c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3168,7 +3168,6 @@ struct gl_matrix_stack
*/
/*@{*/
#define DD_TRI_LIGHT_TWOSIDE (1 << 1)
-#define DD_TRI_UNFILLED (1 << 2)
/*@}*/
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index cdef01a2fe..e1fd0ffaf6 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -172,11 +172,6 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
return;
}
- if (ctx->Polygon.FrontMode == GL_FILL && ctx->Polygon.BackMode == GL_FILL)
- ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
- else
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-
if (ctx->Driver.PolygonMode)
ctx->Driver.PolygonMode(ctx, face, mode);
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f7248647be..da7f713489 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -327,15 +327,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
ctx->_TriangleCaps = 0;
/*
- * Polygons
- */
- if (1/*new_state & _NEW_POLYGON*/) {
- if (ctx->Polygon.FrontMode != GL_FILL
- || ctx->Polygon.BackMode != GL_FILL)
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
- }
-
- /*
* Lighting and shading
*/
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index ce3e32165a..a42f46053f 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -156,9 +156,11 @@ static void choose_interp_func( struct gl_context *ctx,
GLboolean force_boundary )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
-
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
if (vtx->need_extras &&
- (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
+ ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE) ||
+ unfilled))) {
vtx->interp = _tnl_generic_interp_extras;
} else {
vtx->interp = _tnl_generic_interp;
@@ -171,9 +173,12 @@ static void choose_interp_func( struct gl_context *ctx,
static void choose_copy_pv_func( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
+ GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
if (vtx->need_extras &&
- (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
+ ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE) ||
+ unfilled))) {
vtx->copy_pv = _tnl_generic_copy_pv_extras;
} else {
vtx->copy_pv = _tnl_generic_copy_pv;