i965/fs: demote_pull_constants() did not take into account double types
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Fri, 27 Nov 2015 11:52:22 +0000 (12:52 +0100)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Tue, 10 May 2016 09:25:09 +0000 (11:25 +0200)
The constants could be double, and it was allocating size for float types
for the destination register of varying pull constant loads.

Then the fs_visitor::validate() will complain.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp

index f2bad0d..e105f40 100644 (file)
@@ -2231,9 +2231,16 @@ fs_visitor::lower_constant_loads()
          if (pull_index == -1)
            continue;
 
+         const unsigned index = stage_prog_data->binding_table.pull_constants_start;
+         fs_reg dst;
+
+         if (type_sz(inst->src[i].type) <= 4)
+            dst = vgrf(glsl_type::float_type);
+         else
+            dst = vgrf(glsl_type::double_type);
+
          assert(inst->src[i].stride == 0);
 
-         fs_reg dst = vgrf(glsl_type::float_type);
          const fs_builder ubld = ibld.exec_all().group(8, 0);
          struct brw_reg offset = brw_imm_ud((unsigned)(pull_index * 4) & ~15);
          ubld.emit(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,