i965/fs: fix assign_constant_locations() for doubles
authorConnor Abbott <connor.w.abbott@intel.com>
Wed, 29 Jul 2015 00:06:12 +0000 (17:06 -0700)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Tue, 10 May 2016 09:25:07 +0000 (11:25 +0200)
Uniform doubles will read two registers, in which case we need to mark
both as being live.

v2 (Sam):
  - Use a formula to get the number of registers read with proper
    units (Curro).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/drivers/dri/i965/brw_fs.cpp

index d0ce79d101a12ba7fb18bdfd4e0ba810baf51b27..6eae49fdf4a59bd29c2cbad8f27e147dfaaf1934 100644 (file)
@@ -2056,8 +2056,12 @@ fs_visitor::assign_constant_locations()
             }
             is_live[last] = true;
          } else {
-            if (constant_nr >= 0 && constant_nr < (int) uniforms)
-               is_live[constant_nr] = true;
+            if (constant_nr >= 0 && constant_nr < (int) uniforms) {
+               int regs_read = inst->components_read(i) *
+                  type_sz(inst->src[i].type) / 4;
+               for (int j = 0; j < regs_read; j++)
+                  is_live[constant_nr + j] = true;
+            }
          }
       }
    }