summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nvfx_state.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-05-14 13:04:42 +0100
committerKeith Whitwell <[email protected]>2010-05-14 13:04:42 +0100
commit0bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72c (patch)
treeb5e83bf73e7fa711579bc3a2e2d0578d3b1c9e11 /src/gallium/drivers/nvfx/nvfx_state.c
parentfc4d1b9ba965f26c504e6f5fea12e2bac2d71d72 (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/nvfx/nvfx_state.c')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.c73
1 files changed, 23 insertions, 50 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c
index 315de492dab..d7177b0f0bb 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.c
+++ b/src/gallium/drivers/nvfx/nvfx_state.c
@@ -216,66 +216,39 @@ nvfx_rasterizer_state_create(struct pipe_context *pipe,
sb_data(sb, fui(cso->point_size));
sb_method(sb, NV34TCL_POLYGON_MODE_FRONT, 6);
- if (cso->front_winding == PIPE_WINDING_CCW) {
- sb_data(sb, nvgl_polygon_mode(cso->fill_ccw));
- sb_data(sb, nvgl_polygon_mode(cso->fill_cw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_CW:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_BOTH:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- }
+ sb_data(sb, nvgl_polygon_mode(cso->fill_front));
+ sb_data(sb, nvgl_polygon_mode(cso->fill_back));
+ switch (cso->cull_mode) {
+ case PIPE_FACE_FRONT:
+ sb_data(sb, NV34TCL_CULL_FACE_FRONT);
+ break;
+ case PIPE_FACE_BACK:
+ sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ break;
+ case PIPE_FACE_FRONT_AND_BACK:
+ sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
+ break;
+ default:
+ sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ break;
+ }
+ if (cso->front_ccw) {
sb_data(sb, NV34TCL_FRONT_FACE_CCW);
} else {
- sb_data(sb, nvgl_polygon_mode(cso->fill_cw));
- sb_data(sb, nvgl_polygon_mode(cso->fill_ccw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_CW:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_BOTH:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- }
sb_data(sb, NV34TCL_FRONT_FACE_CW);
}
sb_data(sb, cso->poly_smooth ? 1 : 0);
- sb_data(sb, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
+ sb_data(sb, (cso->cull_face != PIPE_FACE_NONE) ? 1 : 0);
sb_method(sb, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
sb_data(sb, cso->poly_stipple_enable ? 1 : 0);
sb_method(sb, NV34TCL_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))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if (cso->offset_cw || cso->offset_ccw) {
+ sb_data(sb, cso->offset_point);
+ sb_data(sb, cso->offset_line);
+ sb_data(sb, cso->offset_tri);
+
+ if (cso->offset_point || cso->offset_line || cso->offset_tri) {
sb_method(sb, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
sb_data(sb, fui(cso->offset_scale));
sb_data(sb, fui(cso->offset_units * 2));