[Mesa-dev] [PATCH 14/21] i965/fs: Handle reladdr in liveness calculations in assign_constant_locations

Jason Ekstrand jason at jlekstrand.net
Wed Aug 19 22:45:49 PDT 2015


Previously, we weren't handling reladdr at all.  However, this was ok,
because we had already marked everything that's ever touched indirectly as
push so that was ignored.  As soon as we start using indirect push
constants, this will no longer be true so the liveness calculations will
need to be correct.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b4003e0..d321684 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1827,9 +1827,18 @@ fs_visitor::assign_constant_locations()
          if (inst->src[i].file != UNIFORM)
             continue;
 
-         int constant_nr = inst->src[i].reg + inst->src[i].reg_offset;
-         if (constant_nr >= 0 && constant_nr < (int) uniforms)
-            is_live[constant_nr] = true;
+         if (inst->src[i].reladdr) {
+            int uniform = inst->src[i].reg;
+
+            for (int j = uniform; j < uniform + param_size[uniform]; j++) {
+               if (j >= 0 && j < (int) uniforms)
+                  is_live[j] = true;
+            }
+         } else {
+            int constant_nr = inst->src[i].reg + inst->src[i].reg_offset;
+            if (constant_nr >= 0 && constant_nr < (int) uniforms)
+               is_live[constant_nr] = true;
+         }
       }
    }
 
-- 
2.4.3



More information about the mesa-dev mailing list