Mesa (master): i965/gs: Stop storing an input VUE map in the GS program key .

Paul Berry stereotype441 at kemper.freedesktop.org
Mon Sep 16 20:07:16 UTC 2013


Module: Mesa
Branch: master
Commit: 8a36f4382be0b9ad357f589dc326e14593bdbe8e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a36f4382be0b9ad357f589dc326e14593bdbe8e

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Sep  2 14:02:22 2013 -0700

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 <kenneth at whitecape.org>

---

 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 2d1d163..c526107 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 960f970..cb7de8d 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 90dd1de..e8da2e3 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;
 




More information about the mesa-commit mailing list