gallium: more work on ccw flag removal

The linux-debug target builds...
This commit is contained in:
Keith Whitwell
2010-05-14 19:20:25 +01:00
parent 0bd1cbcd0d
commit 9c264642c3
11 changed files with 79 additions and 74 deletions

View File

@@ -53,21 +53,6 @@ static GLuint translate_fill( GLenum mode )
}
}
static GLboolean get_offset_flag( GLuint fill_mode,
const struct gl_polygon_attrib *p )
{
switch (fill_mode) {
case PIPE_POLYGON_MODE_POINT:
return p->OffsetPoint;
case PIPE_POLYGON_MODE_LINE:
return p->OffsetLine;
case PIPE_POLYGON_MODE_FILL:
return p->OffsetFill;
default:
assert(0);
return 0;
}
}
static void update_raster_state( struct st_context *st )
@@ -82,10 +67,7 @@ static void update_raster_state( struct st_context *st )
/* _NEW_POLYGON, _NEW_BUFFERS
*/
{
if (ctx->Polygon.FrontFace == GL_CCW)
raster->front_winding = PIPE_WINDING_CCW;
else
raster->front_winding = PIPE_WINDING_CW;
raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
/* XXX
* I think the intention here is that user-created framebuffer objects
@@ -94,7 +76,7 @@ static void update_raster_state( struct st_context *st )
* But this is an implementation/driver-specific artifact - remove...
*/
if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
raster->front_winding ^= PIPE_WINDING_BOTH;
raster->front_ccw ^= 1;
}
/* _NEW_LIGHT
@@ -131,40 +113,36 @@ static void update_raster_state( struct st_context *st )
/* _NEW_POLYGON
*/
if (ctx->Polygon.CullFlag) {
if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
raster->cull_mode = PIPE_WINDING_BOTH;
}
else if (ctx->Polygon.CullFaceMode == GL_FRONT) {
raster->cull_mode = raster->front_winding;
}
else {
raster->cull_mode = raster->front_winding ^ PIPE_WINDING_BOTH;
switch (ctx->Polygon.CullFaceMode) {
case GL_FRONT:
raster->cull_face = PIPE_FACE_FRONT;
break;
case GL_BACK:
raster->cull_face = PIPE_FACE_BACK;
break;
case GL_FRONT_AND_BACK:
raster->cull_face = PIPE_FACE_FRONT_AND_BACK;
break;
}
}
else {
raster->cull_face = PIPE_FACE_NONE;
}
/* _NEW_POLYGON
*/
{
GLuint fill_front = translate_fill( ctx->Polygon.FrontMode );
GLuint fill_back = translate_fill( ctx->Polygon.BackMode );
if (raster->front_winding == PIPE_WINDING_CW) {
raster->fill_cw = fill_front;
raster->fill_ccw = fill_back;
}
else {
raster->fill_cw = fill_back;
raster->fill_ccw = fill_front;
}
raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
raster->fill_back = translate_fill( ctx->Polygon.BackMode );
/* Simplify when culling is active:
*/
if (raster->cull_mode & PIPE_WINDING_CW) {
raster->fill_cw = raster->fill_ccw;
if (raster->cull_face & PIPE_FACE_FRONT) {
raster->fill_front = raster->fill_back;
}
if (raster->cull_mode & PIPE_WINDING_CCW) {
raster->fill_ccw = raster->fill_cw;
if (raster->cull_face & PIPE_FACE_BACK) {
raster->fill_back = raster->fill_front;
}
}
@@ -172,8 +150,14 @@ static void update_raster_state( struct st_context *st )
*/
if (ctx->Polygon.OffsetUnits != 0.0 ||
ctx->Polygon.OffsetFactor != 0.0) {
raster->offset_cw = get_offset_flag( raster->fill_cw, &ctx->Polygon );
raster->offset_ccw = get_offset_flag( raster->fill_ccw, &ctx->Polygon );
raster->offset_point = ctx->Polygon.OffsetPoint;
raster->offset_line = ctx->Polygon.OffsetLine;
raster->offset_tri = ctx->Polygon.OffsetFill;
}
if (ctx->Polygon.OffsetPoint ||
ctx->Polygon.OffsetLine ||
ctx->Polygon.OffsetFill) {
raster->offset_units = ctx->Polygon.OffsetUnits;
raster->offset_scale = ctx->Polygon.OffsetFactor;
}