i965: Move multiply by 4 for VS ATTR setup into the scalar backend.
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 3 May 2017 23:56:15 +0000 (16:56 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 9 May 2017 22:07:47 +0000 (15:07 -0700)
The vec4 backend will want to count in units of vec4s, not scalar
components.  The simplest solution is to move the multiplication by 4
into the scalar backend.  This also improves consistency with how we
count varyings.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs_nir.cpp
src/intel/compiler/brw_nir.c

index 2ea94ab69398c7f2388e1531bc4390fd8175fce9..d90eaad32ba6aeedfebff08bbbebfd942baa8801 100644 (file)
@@ -2251,7 +2251,7 @@ fs_visitor::nir_emit_vs_intrinsic(const fs_builder &bld,
    }
 
    case nir_intrinsic_load_input: {
-      fs_reg src = fs_reg(ATTR, instr->const_index[0], dest.type);
+      fs_reg src = fs_reg(ATTR, nir_intrinsic_base(instr) * 4, dest.type);
       unsigned first_component = nir_intrinsic_component(instr);
       unsigned num_components = instr->num_components;
       enum brw_reg_type type = dest.type;
index f5b66121176f3e10046aa3aaa41c034977e44d84..2c44d8f18280f9f043021133e2b2efc92a11d253 100644 (file)
@@ -279,7 +279,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
                int attr = nir_intrinsic_base(intrin);
                int slot = _mesa_bitcount_64(nir->info.inputs_read &
                                             BITFIELD64_MASK(attr));
-               nir_intrinsic_set_base(intrin, 4 * slot);
+               nir_intrinsic_set_base(intrin, slot);
             }
          }
       }