[Mesa-dev] [PATCH 09/15] i965/gs: Stop storing an input VUE map in the GS program key.
Paul Berry
stereotype441 at gmail.com
Tue Sep 3 16:18:21 PDT 2013
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.
---
src/mesa/drivers/dri/i965/brw_vec4_gs.c | 6 ++++--
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h | 3 ++-
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 94c4017..5e67d1a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
@@ -167,10 +167,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;
@@ -239,7 +241,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 d82a26e..ae78855 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 fba0ac6..48623d8 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;
};
--
1.8.4
More information about the mesa-dev
mailing list