[Mesa-dev] [PATCH 15/36] i965: SF: change get_vert_attr to use the VUE map, and rename it.
Paul Berry
stereotype441 at gmail.com
Fri Sep 2 09:06:54 PDT 2011
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.
---
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 f1fe567..f362e20 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));
}
}
--
1.7.6
More information about the mesa-dev
mailing list