summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2011-08-23 15:49:32 -0700
committerPaul Berry <[email protected]>2011-09-06 11:04:34 -0700
commit4a1fb81902a7863d5dfe304e5e4ca2c631159be1 (patch)
tree1f7a5f48eab63cf2bfc7623bd7bf980eed77e0bd /src/mesa
parent39fc725b0c81db8d76cb490488cd95de5c4d7a79 (diff)
i965: SF: Modify calculate_point_sprite_mask to use the VUE map.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_emit.c32
3 files changed, 32 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index 1c149dbfd1e..7b003dcdff7 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -67,6 +67,9 @@ static void compile_sf_prog( struct brw_context *brw,
c.nr_attr_regs = (c.nr_attrs+1)/2;
c.nr_setup_attrs = brw_count_bits(c.key.attrs);
c.nr_setup_regs = (c.nr_setup_attrs+1)/2;
+ brw_compute_vue_map(&c.vue_map, intel, c.key.nr_userclip,
+ c.key.do_twoside_color, c.key.attrs);
+ c.urb_entry_read_offset = brw_sf_compute_urb_entry_read_offset(intel);
c.prog_data.urb_read_length = c.nr_attr_regs;
c.prog_data.urb_entry_size = c.nr_setup_regs * 2;
@@ -163,6 +166,9 @@ static void upload_sf_prog(struct brw_context *brw)
break;
}
+ /* _NEW_TRANSFORM */
+ key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
+
/* _NEW_POINT */
key.do_point_sprite = ctx->Point.PointSprite;
if (key.do_point_sprite) {
@@ -198,7 +204,7 @@ static void upload_sf_prog(struct brw_context *brw)
const struct brw_tracked_state brw_sf_prog = {
.dirty = {
- .mesa = (_NEW_HINT | _NEW_LIGHT | _NEW_POLYGON | _NEW_POINT),
+ .mesa = (_NEW_HINT | _NEW_LIGHT | _NEW_POLYGON | _NEW_POINT | _NEW_TRANSFORM),
.brw = (BRW_NEW_REDUCED_PRIMITIVE),
.cache = CACHE_NEW_VS_PROG
},
diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h
index 102df3302ac..12c655f0923 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.h
+++ b/src/mesa/drivers/dri/i965/brw_sf.h
@@ -53,7 +53,8 @@ struct brw_sf_prog_key {
GLuint frontface_ccw:1;
GLuint do_point_sprite:1;
GLuint sprite_origin_lower_left:1;
- GLuint pad:24;
+ GLuint nr_userclip:4;
+ GLuint pad:20;
};
struct brw_sf_compile {
@@ -93,9 +94,11 @@ struct brw_sf_compile {
GLuint nr_attr_regs;
GLuint nr_setup_attrs;
GLuint nr_setup_regs;
+ int urb_entry_read_offset;
GLubyte attr_to_idx[VERT_RESULT_MAX];
GLubyte idx_to_attr[VERT_RESULT_MAX];
+ struct brw_vue_map vue_map;
};
diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
index 52a3fb3893d..f1fe567c88a 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
@@ -43,6 +43,18 @@
#include "brw_sf.h"
+/**
+ * Determine the vert_result corresponding to the given half of the given
+ * register. half=0 means the first half of a register, half=1 means the
+ * second half.
+ */
+static inline int vert_reg_to_vert_result(struct brw_sf_compile *c, GLuint reg,
+ int half)
+{
+ int vue_slot = (reg + c->urb_entry_read_offset) * 2 + half;
+ 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)
@@ -359,22 +371,20 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
static uint16_t
calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg)
{
- int attr1, attr2;
+ int vert_result1, vert_result2;
uint16_t pc = 0;
- attr1 = c->idx_to_attr[reg * 2];
- if (attr1 >= VERT_RESULT_TEX0 && attr1 <= VERT_RESULT_TEX7) {
- if (c->key.point_sprite_coord_replace & (1 << (attr1 - VERT_RESULT_TEX0)))
+ vert_result1 = vert_reg_to_vert_result(c, reg, 0);
+ if (vert_result1 >= VERT_RESULT_TEX0 && vert_result1 <= VERT_RESULT_TEX7) {
+ if (c->key.point_sprite_coord_replace & (1 << (vert_result1 - VERT_RESULT_TEX0)))
pc |= 0x0f;
}
- if (reg * 2 + 1 < c->nr_setup_attrs) {
- attr2 = c->idx_to_attr[reg * 2 + 1];
- if (attr2 >= VERT_RESULT_TEX0 && attr2 <= VERT_RESULT_TEX7) {
- if (c->key.point_sprite_coord_replace & (1 << (attr2 -
- VERT_RESULT_TEX0)))
- pc |= 0xf0;
- }
+ vert_result2 = vert_reg_to_vert_result(c, reg, 1);
+ if (vert_result2 >= VERT_RESULT_TEX0 && vert_result2 <= VERT_RESULT_TEX7) {
+ if (c->key.point_sprite_coord_replace & (1 << (vert_result2 -
+ VERT_RESULT_TEX0)))
+ pc |= 0xf0;
}
return pc;