diff options
author | Paul Berry <[email protected]> | 2011-08-24 12:19:10 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2011-09-06 11:04:37 -0700 |
commit | 8b362477d931af40e1a00fc308ebd0b25b722aa2 (patch) | |
tree | 5f2c4baf68b4b619e320f15a75516af87b5dc783 /src | |
parent | 4a1fb81902a7863d5dfe304e5e4ca2c631159be1 (diff) |
i965: SF: change get_vert_attr to use the VUE map, and rename it.
The new function, called get_vert_result(), uses the VUE map to find
the register containing a given vertex attribute. Previously, we used
the attr_to_idx[] array, which served the same purpose but didn't
account for gl_PointSize correctly.
This fixes a bug on pre-Gen6 wherein the back side of a triangle would
be rendered incorrectyl if the vertex shader wrote to gl_PointSize.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sf_emit.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index f1fe567c88a..f362e204bca 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -55,12 +55,17 @@ static inline int vert_reg_to_vert_result(struct brw_sf_compile *c, GLuint reg, return c->vue_map.slot_to_vert_result[vue_slot]; } -static struct brw_reg get_vert_attr(struct brw_sf_compile *c, - struct brw_reg vert, - GLuint attr) +/** + * Determine the register corresponding to the given vert_result. + */ +static struct brw_reg get_vert_result(struct brw_sf_compile *c, + struct brw_reg vert, + GLuint vert_result) { - GLuint off = c->attr_to_idx[attr] / 2; - GLuint sub = c->attr_to_idx[attr] % 2; + int vue_slot = c->vue_map.vert_result_to_slot[vert_result]; + assert (vue_slot >= c->urb_entry_read_offset); + GLuint off = vue_slot / 2 - c->urb_entry_read_offset; + GLuint sub = vue_slot % 2; return brw_vec4_grf(vert.nr + off, sub * 4); } @@ -84,8 +89,8 @@ static void copy_bfc( struct brw_sf_compile *c, if (have_attr(c, VERT_RESULT_COL0+i) && have_attr(c, VERT_RESULT_BFC0+i)) brw_MOV(p, - get_vert_attr(c, vert, VERT_RESULT_COL0+i), - get_vert_attr(c, vert, VERT_RESULT_BFC0+i)); + get_vert_result(c, vert, VERT_RESULT_COL0+i), + get_vert_result(c, vert, VERT_RESULT_BFC0+i)); } } @@ -146,8 +151,8 @@ static void copy_colors( struct brw_sf_compile *c, for (i = VERT_RESULT_COL0; i <= VERT_RESULT_COL1; i++) { if (have_attr(c,i)) brw_MOV(p, - get_vert_attr(c, dst, i), - get_vert_attr(c, src, i)); + get_vert_result(c, dst, i), + get_vert_result(c, src, i)); } } |