diff options
author | Keith Whitwell <[email protected]> | 2010-05-21 15:41:06 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2010-05-21 15:41:06 +0100 |
commit | ef9b4d20d78a748e653a61286d83f33dc6c46184 (patch) | |
tree | 19c9c63de1ceeed4b2615ea5bd451f2e590b1018 /src/gallium/auxiliary/draw | |
parent | 0293b1abf54d0f262c3fe84ab9a3b5c525a95009 (diff) | |
parent | 0ff2373131011cf3d7dec737aa4ef5f54d2b7ba5 (diff) |
Merge branch 'gallium-front-ccw'
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_cull.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_twoside.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_unfilled.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_validate.c | 19 |
5 files changed, 27 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 02abddf1491..61980c3e4f5 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -566,7 +566,7 @@ draw_get_rasterizer_no_cull( struct draw_context *draw, memset(&rast, 0, sizeof(rast)); rast.scissor = scissor; rast.flatshade = flatshade; - rast.front_winding = PIPE_WINDING_CCW; + rast.front_ccw = 1; rast.gl_rasterization_rules = draw->rasterizer->gl_rasterization_rules; draw->rasterizer_no_cull[scissor][flatshade] = diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c index dc66c65a56c..bf84ce30ed1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_cull.c +++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c @@ -40,7 +40,8 @@ struct cull_stage { struct draw_stage stage; - unsigned winding; /**< which winding(s) to cull (one of PIPE_WINDING_x) */ + unsigned cull_face; /**< which face(s) to cull (one of PIPE_FACE_x) */ + unsigned front_ccw; }; @@ -73,9 +74,12 @@ static void cull_tri( struct draw_stage *stage, /* if det < 0 then Z points toward the camera and the triangle is * counter-clockwise winding. */ - unsigned winding = (header->det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW; + unsigned ccw = (header->det < 0); + unsigned face = ((ccw == cull_stage(stage)->front_ccw) ? + PIPE_FACE_FRONT : + PIPE_FACE_BACK); - if ((winding & cull_stage(stage)->winding) == 0) { + if ((face & cull_stage(stage)->cull_face) == 0) { /* triangle is not culled, pass to next stage */ stage->next->tri( stage->next, header ); } @@ -88,7 +92,8 @@ static void cull_first_tri( struct draw_stage *stage, { struct cull_stage *cull = cull_stage(stage); - cull->winding = stage->draw->rasterizer->cull_mode; + cull->cull_face = stage->draw->rasterizer->cull_face; + cull->front_ccw = stage->draw->rasterizer->front_ccw; stage->tri = cull_tri; stage->tri( stage, header ); diff --git a/src/gallium/auxiliary/draw/draw_pipe_twoside.c b/src/gallium/auxiliary/draw/draw_pipe_twoside.c index eef0238b157..808b2fb0b58 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_twoside.c +++ b/src/gallium/auxiliary/draw/draw_pipe_twoside.c @@ -141,7 +141,7 @@ static void twoside_first_tri( struct draw_stage *stage, * if the triangle is back-facing (negative). * sign = -1 for CCW, +1 for CW */ - twoside->sign = (stage->draw->rasterizer->front_winding == PIPE_WINDING_CCW) ? -1.0f : 1.0f; + twoside->sign = stage->draw->rasterizer->front_ccw ? -1.0f : 1.0f; stage->tri = twoside_tri; stage->tri( stage, header ); diff --git a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c index a30fada86a0..e333d26a932 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c +++ b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c @@ -134,7 +134,8 @@ static void unfilled_tri( struct draw_stage *stage, struct prim_header *header ) { struct unfilled_stage *unfilled = unfilled_stage(stage); - unsigned mode = unfilled->mode[header->det >= 0.0]; + unsigned cw = header->det >= 0.0; + unsigned mode = unfilled->mode[cw]; if (0) print_header_flags(header->flags); @@ -159,9 +160,10 @@ static void unfilled_first_tri( struct draw_stage *stage, struct prim_header *header ) { struct unfilled_stage *unfilled = unfilled_stage(stage); + const struct pipe_rasterizer_state *rast = stage->draw->rasterizer; - unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */ - unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */ + unfilled->mode[0] = rast->front_ccw ? rast->fill_front : rast->fill_back; + unfilled->mode[1] = rast->front_ccw ? rast->fill_back : rast->fill_front; stage->tri = unfilled_tri; stage->tri( stage, header ); diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 2a50af7a414..eafa29276ff 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -122,12 +122,14 @@ draw_need_pipeline(const struct draw_context *draw, return TRUE; /* unfilled polygons */ - if (rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL || - rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) + if (rasterizer->fill_front != PIPE_POLYGON_MODE_FILL || + rasterizer->fill_back != PIPE_POLYGON_MODE_FILL) return TRUE; /* polygon offset */ - if (rasterizer->offset_cw || rasterizer->offset_ccw) + if (rasterizer->offset_point || + rasterizer->offset_line || + rasterizer->offset_tri) return TRUE; /* two-side lighting */ @@ -222,8 +224,8 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) next = draw->pipeline.pstipple; } - if (rast->fill_cw != PIPE_POLYGON_MODE_FILL || - rast->fill_ccw != PIPE_POLYGON_MODE_FILL) { + if (rast->fill_front != PIPE_POLYGON_MODE_FILL || + rast->fill_back != PIPE_POLYGON_MODE_FILL) { draw->pipeline.unfilled->next = next; next = draw->pipeline.unfilled; precalc_flat = TRUE; /* only needed for triangles really */ @@ -235,8 +237,9 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) next = draw->pipeline.flatshade; } - if (rast->offset_cw || - rast->offset_ccw) { + if (rast->offset_point || + rast->offset_line || + rast->offset_tri) { draw->pipeline.offset->next = next; next = draw->pipeline.offset; need_det = TRUE; @@ -255,7 +258,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) * to less work emitting vertices, smaller vertex buffers, etc. * It's difficult to say whether this will be true in general. */ - if (need_det || rast->cull_mode) { + if (need_det || rast->cull_face != PIPE_FACE_NONE) { draw->pipeline.cull->next = next; next = draw->pipeline.cull; } |