summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-09-02 14:02:22 -0700
committerPaul Berry <[email protected]>2013-09-16 12:53:40 -0700
commit8a36f4382be0b9ad357f589dc326e14593bdbe8e (patch)
tree55cd8f41fc24087218c81158f9c845124173621a
parentd1ad447f0187f5e6044fec65ace6ce1e10b156c2 (diff)
i965/gs: Stop storing an input VUE map in the GS program key.
Now that the vertex shader output VUE map is determined solely by a 64-bit bitfield, we don't have to store it in its entirety in the geometry shader program key; instead, we can just store the bitfield, and let the geometry shader infer the VUE map at compile time. This dramatically reduces the size of the geometry shader program key, which we want to keep small since it gets recomputed whenever the active program changes. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h3
3 files changed, 8 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
index 2d1d163bad1..c5261072600 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
@@ -200,10 +200,12 @@ do_gs_prog(struct brw_context *brw,
c.prog_data.output_topology = prim_to_hw_prim[gp->program.OutputType];
+ brw_compute_vue_map(brw, &c.input_vue_map, c.key.input_varyings);
+
/* GS inputs are read from the VUE 256 bits (2 vec4's) at a time, so we
* need to program a URB read length of ceiling(num_slots / 2).
*/
- c.prog_data.base.urb_read_length = (c.key.input_vue_map.num_slots + 1) / 2;
+ c.prog_data.base.urb_read_length = (c.input_vue_map.num_slots + 1) / 2;
void *mem_ctx = ralloc_context(NULL);
unsigned program_size;
@@ -272,7 +274,7 @@ brw_upload_gs_prog(struct brw_context *brw)
&key.base.tex);
/* BRW_NEW_VUE_MAP_VS */
- key.input_vue_map = brw->vue_map_vs;
+ key.input_varyings = brw->vue_map_vs.slots_valid;
if (!brw_search_cache(&brw->cache, BRW_GS_PROG,
&key, sizeof(key),
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 960f9703252..cb7de8d17bf 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -70,8 +70,8 @@ vec4_gs_visitor::setup_varying_inputs(int payload_reg, int *attribute_map)
assert(num_input_vertices <= MAX_GS_INPUT_VERTICES);
unsigned input_array_stride = c->prog_data.base.urb_read_length * 2;
- for (int slot = 0; slot < c->key.input_vue_map.num_slots; slot++) {
- int varying = c->key.input_vue_map.slot_to_varying[slot];
+ for (int slot = 0; slot < c->input_vue_map.num_slots; slot++) {
+ int varying = c->input_vue_map.slot_to_varying[slot];
for (unsigned vertex = 0; vertex < num_input_vertices; vertex++) {
attribute_map[BRW_VARYING_SLOT_COUNT * vertex + varying] =
payload_reg + input_array_stride * vertex + slot;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 90dd1de7c7a..e8da2e351a2 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -37,7 +37,7 @@ struct brw_gs_prog_key
{
struct brw_vec4_prog_key base;
- struct brw_vue_map input_vue_map;
+ GLbitfield64 input_varyings;
};
@@ -49,6 +49,7 @@ struct brw_gs_compile
struct brw_vec4_compile base;
struct brw_gs_prog_key key;
struct brw_gs_prog_data prog_data;
+ struct brw_vue_map input_vue_map;
struct brw_geometry_program *gp;