diff options
author | Keith Whitwell <[email protected]> | 2010-05-14 13:04:42 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2010-05-14 13:04:42 +0100 |
commit | 0bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72c (patch) | |
tree | b5e83bf73e7fa711579bc3a2e2d0578d3b1c9e11 /src/gallium/drivers/nv50/nv50_state.c | |
parent | fc4d1b9ba965f26c504e6f5fea12e2bac2d71d72 (diff) |
gallium: convert rasterizer state to use gl-style front/back concepts
Use front/back instead of cw/ccw throughout.
Also, use offset_point/line/fill instead of offset_cw/ccw.
Brings gallium representation of this state into line with its main
user, and also what turns out to be the most common hardware
representation.
This fixes a long-standing bias in the interface towards the
architecture of the software rasterizer.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state.c')
-rw-r--r-- | src/gallium/drivers/nv50/nv50_state.c | 82 |
1 files changed, 27 insertions, 55 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index e885a2b7196..2f11ed001bb 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -345,7 +345,7 @@ nv50_rasterizer_state_create(struct pipe_context *pipe, CALLOC_STRUCT(nv50_rasterizer_stateobj); /*XXX: ignored - * - light_twosize + * - light_twoside * - point_smooth * - multisample * - point_sprite / sprite_coord_mode @@ -385,72 +385,44 @@ nv50_rasterizer_state_create(struct pipe_context *pipe, so_data (so, cso->point_quad_rasterization ? 1 : 0); so_method(so, tesla, NV50TCL_POLYGON_MODE_FRONT, 3); - if (cso->front_winding == PIPE_WINDING_CCW) { - so_data(so, nvgl_polygon_mode(cso->fill_ccw)); - so_data(so, nvgl_polygon_mode(cso->fill_cw)); - } else { - so_data(so, nvgl_polygon_mode(cso->fill_cw)); - so_data(so, nvgl_polygon_mode(cso->fill_ccw)); - } + so_data(so, nvgl_polygon_mode(cso->fill_front)); + so_data(so, nvgl_polygon_mode(cso->fill_back)); so_data(so, cso->poly_smooth ? 1 : 0); so_method(so, tesla, NV50TCL_CULL_FACE_ENABLE, 3); - so_data (so, cso->cull_mode != PIPE_WINDING_NONE); - if (cso->front_winding == PIPE_WINDING_CCW) { + so_data (so, cso->cull_mode != PIPE_FACE_NONE); + if (cso->front_ccw) { so_data(so, NV50TCL_FRONT_FACE_CCW); - switch (cso->cull_mode) { - case PIPE_WINDING_CCW: - so_data(so, NV50TCL_CULL_FACE_FRONT); - break; - case PIPE_WINDING_CW: - so_data(so, NV50TCL_CULL_FACE_BACK); - break; - case PIPE_WINDING_BOTH: - so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK); - break; - default: - so_data(so, NV50TCL_CULL_FACE_BACK); - break; - } - } else { + } + else { so_data(so, NV50TCL_FRONT_FACE_CW); - switch (cso->cull_mode) { - case PIPE_WINDING_CCW: - so_data(so, NV50TCL_CULL_FACE_BACK); - break; - case PIPE_WINDING_CW: - so_data(so, NV50TCL_CULL_FACE_FRONT); - break; - case PIPE_WINDING_BOTH: - so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK); - break; - default: - so_data(so, NV50TCL_CULL_FACE_BACK); - break; - } + } + switch (cso->cull_face) { + case PIPE_FACE_FRONT: + so_data(so, NV50TCL_CULL_FACE_FRONT); + break; + case PIPE_FACE_BACK: + so_data(so, NV50TCL_CULL_FACE_BACK); + break; + case PIPE_FACE_FRONT_AND_BACK: + so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK); + break; + default: + so_data(so, NV50TCL_CULL_FACE_BACK); + break; } so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_ENABLE, 1); so_data (so, cso->poly_stipple_enable ? 1 : 0); so_method(so, tesla, NV50TCL_POLYGON_OFFSET_POINT_ENABLE, 3); - if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) || - (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT)) - so_data(so, 1); - else - so_data(so, 0); - if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) || - (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE)) - so_data(so, 1); - else - so_data(so, 0); - if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) || - (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL)) - so_data(so, 1); - else - so_data(so, 0); + so_data(so, cso->offset_point); + so_data(so, cso->offset_line); + so_data(so, cso->offset_tri); - if (cso->offset_cw || cso->offset_ccw) { + if (cso->offset_point || + cso->offset_line || + cso->offset_tri) { so_method(so, tesla, NV50TCL_POLYGON_OFFSET_FACTOR, 1); so_data (so, fui(cso->offset_scale)); so_method(so, tesla, NV50TCL_POLYGON_OFFSET_UNITS, 1); |