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;
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) {
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
},
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 {
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;
};
#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)
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;