diff options
Diffstat (limited to 'src/gallium/auxiliary')
-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 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blit.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_dump_state.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_gen_mipmap.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 18 |
10 files changed, 55 insertions, 29 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; } diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index e3b7839a92a..f6f6e481d94 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -101,8 +101,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) /* rasterizer */ memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer)); - ctx->rasterizer.front_winding = PIPE_WINDING_CW; - ctx->rasterizer.cull_mode = PIPE_WINDING_NONE; + ctx->rasterizer.cull_face = PIPE_FACE_NONE; ctx->rasterizer.gl_rasterization_rules = 1; /* samplers */ diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 157b3853e45..3a7c4db6f34 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -175,8 +175,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) /* rasterizer state */ memset(&rs_state, 0, sizeof(rs_state)); - rs_state.front_winding = PIPE_WINDING_CW; - rs_state.cull_mode = PIPE_WINDING_NONE; + rs_state.cull_face = PIPE_FACE_NONE; rs_state.gl_rasterization_rules = 1; rs_state.flatshade = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index 2ce643e90cd..cda5b8ba512 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -300,12 +300,13 @@ util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterize util_dump_member(stream, bool, state, flatshade); util_dump_member(stream, bool, state, light_twoside); - util_dump_member(stream, uint, state, front_winding); - util_dump_member(stream, uint, state, cull_mode); - util_dump_member(stream, uint, state, fill_cw); - util_dump_member(stream, uint, state, fill_ccw); - util_dump_member(stream, bool, state, offset_cw); - util_dump_member(stream, bool, state, offset_ccw); + util_dump_member(stream, uint, state, front_ccw); + util_dump_member(stream, uint, state, cull_face); + util_dump_member(stream, uint, state, fill_front); + util_dump_member(stream, uint, state, fill_back); + util_dump_member(stream, bool, state, offset_point); + util_dump_member(stream, bool, state, offset_line); + util_dump_member(stream, bool, state, offset_tri); util_dump_member(stream, bool, state, scissor); util_dump_member(stream, bool, state, poly_smooth); util_dump_member(stream, bool, state, poly_stipple_enable); diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index eee6030ddcc..1553e08d6ce 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1295,8 +1295,7 @@ util_create_gen_mipmap(struct pipe_context *pipe, /* rasterizer */ memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer)); - ctx->rasterizer.front_winding = PIPE_WINDING_CW; - ctx->rasterizer.cull_mode = PIPE_WINDING_NONE; + ctx->rasterizer.cull_face = PIPE_FACE_NONE; ctx->rasterizer.gl_rasterization_rules = 1; /* sampler state */ diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index a48689ee8be..540305c1465 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -369,6 +369,24 @@ pipe_transfer_destroy( struct pipe_context *context, } +static INLINE boolean util_get_offset( + const struct pipe_rasterizer_state *templ, + unsigned fill_mode) +{ + switch(fill_mode) { + case PIPE_POLYGON_MODE_POINT: + return templ->offset_point; + case PIPE_POLYGON_MODE_LINE: + return templ->offset_line; + case PIPE_POLYGON_MODE_FILL: + return templ->offset_tri; + default: + assert(0); + return FALSE; + } +} + + #ifdef __cplusplus } #endif |