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

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Fri Sep 11 01:33:25 PDT 2015


This patch generates the gather table entries for ordinary uniforms
if they are present. The uniform constants 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 | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index d240371..e39d821 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1863,8 +1863,11 @@ fs_visitor::assign_constant_locations()
       }
    }
 
-   stage_prog_data->nr_params = num_push_constants;
    stage_prog_data->nr_pull_params = num_pull_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.  Move pull constants into pull_param[] and
@@ -1881,8 +1884,21 @@ fs_visitor::assign_constant_locations()
          stage_prog_data->pull_param[pull_constant_loc[i]] = value;
       } else if (push_constant_loc[i] != -1) {
          stage_prog_data->param[push_constant_loc[i]] = value;
+         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