c.func.single_program_flow = 1;
c.key = *key;
- brw_compute_vue_map(&c.vue_map, intel, c.key.nr_userclip > 0, c.key.attrs);
+ brw_compute_vue_map(&c.vue_map, intel, brw->vs.prog_data);
/* nr_regs is the number of registers filled by reading data from the VUE.
* This program accesses the entire VUE, so nr_regs needs to be the size of
*/
/* BRW_NEW_REDUCED_PRIMITIVE */
key.primitive = brw->intel.reduced_primitive;
- /* CACHE_NEW_VS_PROG */
+ /* CACHE_NEW_VS_PROG (also part of VUE map) */
key.attrs = brw->vs.prog_data->outputs_written;
/* _NEW_LIGHT */
key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
key.pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);
- /* _NEW_TRANSFORM */
+ /* _NEW_TRANSFORM (also part of VUE map)*/
key.nr_userclip = _mesa_bitcount_64(ctx->Transform.ClipPlanesEnabled);
if (intel->gen == 5)
bool uses_new_param_layout;
bool uses_vertexid;
+ bool userclip;
};
/* brw_vs.c */
void brw_compute_vue_map(struct brw_vue_map *vue_map,
const struct intel_context *intel,
- bool userclip_active,
- GLbitfield64 outputs_written);
+ const struct brw_vs_prog_data *prog_data);
gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx);
/* brw_wm.c */
memset(&c, 0, sizeof(c));
c.key = *key;
- /* The geometry shader needs to access the entire VUE. */
- brw_compute_vue_map(&c.vue_map, intel, c.key.userclip_active, c.key.attrs);
+ brw_compute_vue_map(&c.vue_map, intel, brw->vs.prog_data);
c.nr_regs = (c.vue_map.num_slots + 1)/2;
mem_ctx = NULL;
memset(key, 0, sizeof(*key));
- /* CACHE_NEW_VS_PROG */
+ /* CACHE_NEW_VS_PROG (part of VUE map) */
key->attrs = brw->vs.prog_data->outputs_written;
/* BRW_NEW_PRIMITIVE */
key->pv_first = true;
}
- /* _NEW_TRANSFORM */
- key->userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
+ /* CACHE_NEW_VS_PROG (part of VUE map)*/
+ key->userclip_active = brw->vs.prog_data->userclip;
if (intel->gen >= 7) {
/* On Gen7 and later, we don't use GS (yet). */
const struct brw_tracked_state brw_gs_prog = {
.dirty = {
.mesa = (_NEW_LIGHT |
- _NEW_TRANSFORM |
_NEW_TRANSFORM_FEEDBACK |
_NEW_RASTERIZER_DISCARD),
.brw = BRW_NEW_PRIMITIVE,
brw_init_compile(brw, &c.func, mem_ctx);
c.key = *key;
- brw_compute_vue_map(&c.vue_map, intel, c.key.userclip_active, c.key.attrs);
+ brw_compute_vue_map(&c.vue_map, intel, brw->vs.prog_data);
c.urb_entry_read_offset = brw_sf_compute_urb_entry_read_offset(intel);
c.nr_attr_regs = (c.vue_map.num_slots + 1)/2 - c.urb_entry_read_offset;
c.nr_setup_regs = c.nr_attr_regs;
/* FINISHME: edgeflag */
- brw_compute_vue_map(&c->vue_map, intel, c->key.userclip_active,
- c->prog_data.outputs_written);
+ brw_compute_vue_map(&c->vue_map, intel, &c->prog_data);
/* First mrf is the g0-based message header containing URB handles and such,
* which is implied in VS_OPCODE_URB_WRITE.
/**
* Compute the VUE map for vertex shader program.
+ *
+ * Note that consumers of this map using cache keys must include
+ * prog_data->userclip and prog_data->outputs_written in their key
+ * (generated by CACHE_NEW_VS_PROG).
*/
void
brw_compute_vue_map(struct brw_vue_map *vue_map,
const struct intel_context *intel,
- bool userclip_active,
- GLbitfield64 outputs_written)
+ const struct brw_vs_prog_data *prog_data)
{
+ bool userclip_active = prog_data->userclip;
+ GLbitfield64 outputs_written = prog_data->outputs_written;
int i;
vue_map->num_slots = 0;
*/
static void brw_vs_alloc_regs( struct brw_vs_compile *c )
{
+ struct brw_context *brw = c->func.brw;
struct intel_context *intel = &c->func.brw->intel;
GLuint i, reg = 0, slot;
int attributes_in_vue;
/* Allocate outputs. The non-position outputs go straight into message regs.
*/
- brw_compute_vue_map(&c->vue_map, intel, c->key.userclip_active,
- c->prog_data.outputs_written);
+ brw_compute_vue_map(&c->vue_map, intel, &c->prog_data);
c->first_output = reg;
first_reladdr_output = get_first_reladdr_output(&c->vp->program);
struct gl_context *ctx = &intel->ctx;
struct brw_vue_map vue_map;
uint32_t urb_entry_read_length;
- /* CACHE_NEW_VS_PROG */
- GLbitfield64 vs_outputs_written = brw->vs.prog_data->outputs_written;
/* BRW_NEW_FRAGMENT_PROGRAM */
uint32_t num_outputs = _mesa_bitcount_64(brw->fragment_program->Base.InputsRead);
/* _NEW_LIGHT */
int urb_entry_read_offset = 1;
float point_size;
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
- bool userclip_active;
uint32_t point_sprite_origin;
- /* _NEW_TRANSFORM */
- userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
-
- brw_compute_vue_map(&vue_map, intel, userclip_active, vs_outputs_written);
+ /* CACHE_NEW_VS_PROG */
+ brw_compute_vue_map(&vue_map, intel, brw->vs.prog_data);
urb_entry_read_length = (vue_map.num_slots + 1)/2 - urb_entry_read_offset;
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so
_NEW_LINE |
_NEW_SCISSOR |
_NEW_BUFFERS |
- _NEW_POINT |
- _NEW_TRANSFORM),
+ _NEW_POINT),
.brw = (BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM),
.cache = CACHE_NEW_VS_PROG
struct gl_context *ctx = &intel->ctx;
struct brw_vue_map vue_map;
uint32_t urb_entry_read_length;
- /* CACHE_NEW_VS_PROG */
- GLbitfield64 vs_outputs_written = brw->vs.prog_data->outputs_written;
/* BRW_NEW_FRAGMENT_PROGRAM */
uint32_t num_outputs = _mesa_bitcount_64(brw->fragment_program->Base.InputsRead);
/* _NEW_LIGHT */
uint32_t dw1, dw10, dw11;
int i;
int attr = 0, input_index = 0;
- /* _NEW_TRANSFORM */
int urb_entry_read_offset = 1;
- bool userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
/* _NEW_BUFFERS */
bool render_to_fbo = ctx->DrawBuffer->Name != 0;
uint32_t point_sprite_origin;
- brw_compute_vue_map(&vue_map, intel, userclip_active, vs_outputs_written);
+ /* CACHE_NEW_VS_PROG */
+ brw_compute_vue_map(&vue_map, intel, brw->vs.prog_data);
urb_entry_read_length = (vue_map.num_slots + 1)/2 - urb_entry_read_offset;
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so
.dirty = {
.mesa = (_NEW_LIGHT |
_NEW_POINT |
- _NEW_PROGRAM |
- _NEW_TRANSFORM),
+ _NEW_PROGRAM),
.brw = (BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM),
.cache = CACHE_NEW_VS_PROG
bool active = xfb_obj->Active && !xfb_obj->Paused;
struct brw_vue_map vue_map;
- /* _NEW_TRANSFORM, CACHE_NEW_VS_PROG */
- brw_compute_vue_map(&vue_map, intel, ctx->Transform.ClipPlanesEnabled != 0,
- brw->vs.prog_data->outputs_written);
+ /* CACHE_NEW_VS_PROG */
+ brw_compute_vue_map(&vue_map, intel, brw->vs.prog_data);
if (active) {
upload_3dstate_so_buffers(brw);
.dirty = {
.mesa = (_NEW_RASTERIZER_DISCARD |
_NEW_LIGHT |
- _NEW_TRANSFORM_FEEDBACK |
- _NEW_TRANSFORM),
+ _NEW_TRANSFORM_FEEDBACK),
.brw = (BRW_NEW_BATCH |
BRW_NEW_VERTEX_PROGRAM),
.cache = CACHE_NEW_VS_PROG,