Again, I don't think having separate classes for tracking temporaries and tracking arrays is a good idea.

They do require some semantic differences, but the only one I can really think of can be summarized as "there are no unconditional writes into arrays". If you think about it that way, it should be quite feasible to refactor the existing temporary tracking code so that it also tracks arrays, simply by skipping the unconditional write optimizations.

Cheers,
Nicolai

On 28.04.2018 21:30, Gert Wollny wrote:
In preparation of the array live range tracking the evaluation of the read
mask is moved out the register live range tracking to the enclosing call
of the reneralized read access tracking.

Signed-off-by: Gert Wollny <gw.foss...@gmail.com>
---
  src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
index 6e799ae731..b6e87e9a02 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
@@ -494,13 +494,8 @@ void temp_access::record_write(int line, prog_scope 
*scope, int writemask)
        comp[3].record_write(line, scope);
  }
-void temp_access::record_read(int line, prog_scope *scope, int swizzle)
+void temp_access::record_read(int line, prog_scope *scope, int readmask)
  {
-   int readmask = 0;
-   for (int idx = 0; idx < 4; ++idx) {
-      int swz = GET_SWZ(swizzle, idx);
-      readmask |= (1 << swz) & 0xF;
-   }
     update_access_mask(readmask);
if (readmask & WRITEMASK_X)
@@ -940,8 +935,14 @@ access_recorder::~access_recorder()
  void access_recorder::record_read(const st_src_reg& src, int line,
                                    prog_scope *scope)
  {
+   int readmask = 0;
+   for (int idx = 0; idx < 4; ++idx) {
+      int swz = GET_SWZ(src.swizzle, idx);
+      readmask |= (1 << swz) & 0xF;
+   }
+
     if (src.file == PROGRAM_TEMPORARY)
-      temp_acc[src.index].record_read(line, scope, src.swizzle);
+      temp_acc[src.index].record_read(line, scope, readmask);
if (src.reladdr)
        record_read(*src.reladdr, line, scope);



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to