[Mesa-dev] [PATCH 17/27] i965/fs: Append uniform entries to the gather table

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Tue Apr 28 13:08:14 PDT 2015


And generate the gather mask constant entries from our uniform data.
Data generated here will later be packed together with UBO constants.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7cc88ea..071ac59 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2272,7 +2272,10 @@ fs_visitor::assign_constant_locations()
       }
    }
 
-   stage_prog_data->nr_params = num_push_constants;
+   stage_prog_data->nr_params = 0;
+
+   unsigned const_reg_access[uniforms];
+   memset(const_reg_access, 0, sizeof(const_reg_access));
 
    /* Up until now, the param[] array has been indexed by reg + reg_offset
     * of UNIFORM registers.  Condense it to only contain the uniforms we
@@ -2286,6 +2289,18 @@ fs_visitor::assign_constant_locations()
 
       assert(remapped <= (int)i);
       stage_prog_data->param[remapped] = stage_prog_data->param[i];
+      int p = stage_prog_data->nr_params++;
+
+      /* access table for uniform registers*/
+      const_reg_access[(ALIGN(prog_data->nr_params, 4) / 4) - 1] |= (1 << (p % 4));
+   }
+
+   int num_consts = ALIGN(prog_data->nr_params, 4) / 4;
+   for (int i = 0; i < num_consts; i++) {
+      int p = stage_prog_data->nr_gather_table++;
+      stage_prog_data->gather_table[p].reg = -1;
+      stage_prog_data->gather_table[p].channel_mask =
+         const_reg_access[i];
    }
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list