summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-05-14 13:04:42 +0100
committerKeith Whitwell <keithw@vmware.com>2010-05-14 13:04:42 +0100
commit0bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72c (patch)
treeb5e83bf73e7fa711579bc3a2e2d0578d3b1c9e11 /src/gallium/drivers/i965
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/i965')
-rw-r--r--src/gallium/drivers/i965/brw_pipe_rast.c41
-rw-r--r--src/gallium/drivers/i965/brw_sf.c2
-rw-r--r--src/gallium/drivers/i965/brw_sf_state.c20
3 files changed, 45 insertions, 18 deletions
diff --git a/src/gallium/drivers/i965/brw_pipe_rast.c b/src/gallium/drivers/i965/brw_pipe_rast.c
index 2117e91a9e..79c445e8b0 100644
--- a/src/gallium/drivers/i965/brw_pipe_rast.c
+++ b/src/gallium/drivers/i965/brw_pipe_rast.c
@@ -42,7 +42,7 @@ calculate_clip_key_rast( const struct brw_context *brw,
key->do_flat_shading = templ->flatshade;
- if (templ->cull_mode == PIPE_WINDING_BOTH) {
+ if (templ->cull_face == PIPE_FACE_FRONT_AND_BACK) {
key->clip_mode = BRW_CLIPMODE_REJECT_ALL;
return;
}
@@ -50,12 +50,18 @@ calculate_clip_key_rast( const struct brw_context *brw,
key->fill_ccw = CLIP_CULL;
key->fill_cw = CLIP_CULL;
- if (!(templ->cull_mode & PIPE_WINDING_CCW)) {
- key->fill_ccw = translate_fill(templ->fill_ccw);
+ if (!(templ->cull_mode & PIPE_FACE_FRONT)) {
+ if (templ->front_ccw)
+ key->fill_ccw = translate_fill(templ->fill_front);
+ else
+ key->fill_cw = translate_fill(templ->fill_front);
}
- if (!(templ->cull_mode & PIPE_WINDING_CW)) {
- key->fill_cw = translate_fill(templ->fill_cw);
+ if (!(templ->cull_mode & PIPE_FACE_BACK)) {
+ if (templ->front_ccw)
+ key->fill_cw = translate_fill(templ->fill_back);
+ else
+ key->fill_ccw = translate_fill(templ->fill_back);
}
if (key->fill_cw == CLIP_LINE ||
@@ -66,8 +72,29 @@ calculate_clip_key_rast( const struct brw_context *brw,
key->clip_mode = BRW_CLIPMODE_CLIP_NON_REJECTED;
}
- key->offset_ccw = templ->offset_ccw;
- key->offset_cw = templ->offset_cw;
+ switch (key->fill_cw) {
+ case CLIP_POINT:
+ key->offset_cw = templ->offset_point;
+ break;
+ case CLIP_LINE:
+ key->offset_cw = templ->offset_line;
+ break;
+ case CLIP_FILL:
+ key->offset_cw = templ->offset_tri;
+ break;
+ }
+
+ switch (key->fill_ccw) {
+ case CLIP_POINT:
+ key->offset_ccw = templ->offset_point;
+ break;
+ case CLIP_LINE:
+ key->offset_ccw = templ->offset_line;
+ break;
+ case CLIP_FILL:
+ key->offset_ccw = templ->offset_tri;
+ break;
+ }
if (templ->light_twoside && key->fill_cw != CLIP_CULL)
key->copy_bfc_cw = 1;
diff --git a/src/gallium/drivers/i965/brw_sf.c b/src/gallium/drivers/i965/brw_sf.c
index 9cceb4dbe5..058b1e12e2 100644
--- a/src/gallium/drivers/i965/brw_sf.c
+++ b/src/gallium/drivers/i965/brw_sf.c
@@ -187,7 +187,7 @@ static enum pipe_error upload_sf_prog(struct brw_context *brw)
key.do_twoside_color = rast->light_twoside;
if (key.do_twoside_color) {
- key.frontface_ccw = (rast->front_winding == PIPE_WINDING_CCW);
+ key.frontface_ccw = rast->front_ccw;
}
if (brw_search_cache(&brw->cache, BRW_SF_PROG,
diff --git a/src/gallium/drivers/i965/brw_sf_state.c b/src/gallium/drivers/i965/brw_sf_state.c
index 0ad91e0307..fede8bd300 100644
--- a/src/gallium/drivers/i965/brw_sf_state.c
+++ b/src/gallium/drivers/i965/brw_sf_state.c
@@ -183,22 +183,22 @@ sf_unit_create_from_key(struct brw_context *brw,
if (key->scissor)
sf.sf6.scissor = 1;
- if (key->front_face == PIPE_WINDING_CCW)
+ if (key->front_ccw)
sf.sf5.front_winding = BRW_FRONTWINDING_CCW;
else
sf.sf5.front_winding = BRW_FRONTWINDING_CW;
- switch (key->cull_mode) {
- case PIPE_WINDING_CCW:
- case PIPE_WINDING_CW:
- sf.sf6.cull_mode = (key->front_face == key->cull_mode ?
- BRW_CULLMODE_FRONT :
- BRW_CULLMODE_BACK);
+ switch (key->cull_face) {
+ case PIPE_FACE_FRONT:
+ sf.sf6.cull_mode = BRW_CULLMODE_FRONT;
break;
- case PIPE_WINDING_BOTH:
+ case PIPE_FACE_BACK:
+ sf.sf6.cull_mode = BRW_CULLMODE_BACK;
+ break;
+ case PIPE_FACE_FRONT_AND_BACK:
sf.sf6.cull_mode = BRW_CULLMODE_BOTH;
break;
- case PIPE_WINDING_NONE:
+ case PIPE_FACE_NONE:
sf.sf6.cull_mode = BRW_CULLMODE_NONE;
break;
default:
@@ -284,7 +284,7 @@ static enum pipe_error upload_sf_unit( struct brw_context *brw )
*/
total_grf = (align(key.total_grf, 16) / 16 - 1);
viewport_transform = 1;
- front_winding = (key.front_face == PIPE_WINDING_CCW ?
+ front_winding = (key.front_ccw ?
BRW_FRONTWINDING_CCW :
BRW_FRONTWINDING_CW);