In the vec4 backend we want uniform locations to be assigned consecutively
since that way the offsets produced by nir_lower_io are exactly what we
need to implement nir_intrinsic_load_uniform. Otherwise we would need a
mapping to match the output of nir_lower_io to the actual uniform registers
we need to use.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
/* Get rid of split copies */
nir_optimize(nir);
/* Get rid of split copies */
nir_optimize(nir);
- nir_assign_var_locations_direct_first(nir, &nir->uniforms,
- &nir->num_direct_uniforms,
- &nir->num_uniforms,
- is_scalar);
+ if (is_scalar) {
+ nir_assign_var_locations_direct_first(nir, &nir->uniforms,
+ &nir->num_direct_uniforms,
+ &nir->num_uniforms,
+ is_scalar);
+ } else {
+ nir_assign_var_locations(&nir->uniforms,
+ &nir->num_uniforms,
+ is_scalar);
+ }
nir_assign_var_locations(&nir->inputs, &nir->num_inputs, is_scalar);
nir_assign_var_locations(&nir->outputs, &nir->num_outputs, is_scalar);
nir_assign_var_locations(&nir->inputs, &nir->num_inputs, is_scalar);
nir_assign_var_locations(&nir->outputs, &nir->num_outputs, is_scalar);