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/drivers/i965 | |
parent | 0293b1abf54d0f262c3fe84ab9a3b5c525a95009 (diff) | |
parent | 0ff2373131011cf3d7dec737aa4ef5f54d2b7ba5 (diff) |
Merge branch 'gallium-front-ccw'
Diffstat (limited to 'src/gallium/drivers/i965')
-rw-r--r-- | src/gallium/drivers/i965/brw_pipe_rast.c | 49 | ||||
-rw-r--r-- | src/gallium/drivers/i965/brw_sf.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/i965/brw_sf_state.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/i965/brw_wm_state.c | 5 |
4 files changed, 58 insertions, 30 deletions
diff --git a/src/gallium/drivers/i965/brw_pipe_rast.c b/src/gallium/drivers/i965/brw_pipe_rast.c index 2117e91a9e4..4c1a6d7dcdf 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_face & 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_face & 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; @@ -111,12 +138,12 @@ static void *brw_create_rasterizer_state( struct pipe_context *pipe, /* Caclculate lookup value for WM IZ table. */ if (templ->line_smooth) { - if (templ->fill_cw == PIPE_POLYGON_MODE_LINE && - templ->fill_ccw == PIPE_POLYGON_MODE_LINE) { + if (templ->fill_front == PIPE_POLYGON_MODE_LINE && + templ->fill_back == PIPE_POLYGON_MODE_LINE) { rast->unfilled_aa_line = AA_ALWAYS; } - else if (templ->fill_cw == PIPE_POLYGON_MODE_LINE || - templ->fill_ccw == PIPE_POLYGON_MODE_LINE) { + else if (templ->fill_front == PIPE_POLYGON_MODE_LINE || + templ->fill_back == PIPE_POLYGON_MODE_LINE) { rast->unfilled_aa_line = AA_SOMETIMES; } else { diff --git a/src/gallium/drivers/i965/brw_sf.c b/src/gallium/drivers/i965/brw_sf.c index 9cceb4dbe52..5abf3848ab4 100644 --- a/src/gallium/drivers/i965/brw_sf.c +++ b/src/gallium/drivers/i965/brw_sf.c @@ -166,8 +166,8 @@ static enum pipe_error upload_sf_prog(struct brw_context *brw) case PIPE_PRIM_TRIANGLES: /* PIPE_NEW_RAST */ - 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) key.primitive = SF_UNFILLED_TRIS; else key.primitive = SF_TRIANGLES; @@ -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 0ad91e03072..6c299a86b49 100644 --- a/src/gallium/drivers/i965/brw_sf_state.c +++ b/src/gallium/drivers/i965/brw_sf_state.c @@ -89,8 +89,8 @@ struct brw_sf_unit_key { unsigned line_smooth:1; unsigned point_sprite:1; unsigned point_attenuated:1; - unsigned front_face:2; - unsigned cull_mode:2; + unsigned front_ccw:1; + unsigned cull_face:2; unsigned flatshade_first:1; unsigned gl_rasterization_rules:1; unsigned line_last_pixel_enable:1; @@ -115,8 +115,8 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key) /* PIPE_NEW_RAST */ key->scissor = rast->scissor; - key->front_face = rast->front_winding; - key->cull_mode = rast->cull_mode; + key->front_ccw = rast->front_ccw; + key->cull_face = rast->cull_face; key->line_smooth = rast->line_smooth; key->line_width = rast->line_width; key->flatshade_first = rast->flatshade_first; @@ -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); diff --git a/src/gallium/drivers/i965/brw_wm_state.c b/src/gallium/drivers/i965/brw_wm_state.c index ee970ac75bc..efc2d96be13 100644 --- a/src/gallium/drivers/i965/brw_wm_state.c +++ b/src/gallium/drivers/i965/brw_wm_state.c @@ -128,8 +128,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) key->line_stipple = brw->curr.rast->templ.line_stipple_enable; - key->offset_enable = (brw->curr.rast->templ.offset_cw || - brw->curr.rast->templ.offset_ccw); + key->offset_enable = (brw->curr.rast->templ.offset_point || + brw->curr.rast->templ.offset_line || + brw->curr.rast->templ.offset_tri); key->offset_units = brw->curr.rast->templ.offset_units; key->offset_factor = brw->curr.rast->templ.offset_scale; |