From: Juan A. Suarez Romero Date: Fri, 1 Apr 2016 15:25:03 +0000 (+0200) Subject: i965: take care of doubles when remapping VS attributes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0fb08e179d784ca319c3c547a874fd24ce93c3f;p=mesa.git i965: take care of doubles when remapping VS attributes Double-precision types require 1 slot in VUE for double and dvec2, and 2 slots for anything else. Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index c501bc157ef..f37bf3a0adf 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -96,7 +96,7 @@ add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode) } static bool -remap_vs_attrs(nir_block *block, GLbitfield64 inputs_read) +remap_vs_attrs(nir_block *block, struct nir_shader_info *nir_info) { nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_intrinsic) @@ -111,9 +111,11 @@ remap_vs_attrs(nir_block *block, GLbitfield64 inputs_read) * before it and counting the bits. */ int attr = intrin->const_index[0]; - int slot = _mesa_bitcount_64(inputs_read & BITFIELD64_MASK(attr)); - - intrin->const_index[0] = 4 * slot; + int slot = _mesa_bitcount_64(nir_info->inputs_read & + BITFIELD64_MASK(attr)); + int dslot = _mesa_bitcount_64(nir_info->double_inputs_read & + BITFIELD64_MASK(attr)); + intrin->const_index[0] = 4 * (slot + dslot); } } return true; @@ -199,9 +201,9 @@ brw_nir_lower_vs_inputs(nir_shader *nir, var->data.driver_location = var->data.location; } - /* Now use nir_lower_io to walk dereference chains. Attribute arrays - * are loaded as one vec4 per element (or matrix column), so we use - * type_size_vec4 here. + /* Now use nir_lower_io to walk dereference chains. Attribute arrays are + * loaded as one vec4 or dvec4 per element (or matrix column), depending on + * whether it is a double-precision type or not. */ nir_lower_io(nir, nir_var_shader_in, type_size_vec4); @@ -214,18 +216,12 @@ brw_nir_lower_vs_inputs(nir_shader *nir, vs_attrib_wa_flags); if (is_scalar) { - /* Finally, translate VERT_ATTRIB_* values into the actual registers. - * - * Note that we can use nir->info.inputs_read instead of - * key->inputs_read since the two are identical aside from Gen4-5 - * edge flag differences. - */ - GLbitfield64 inputs_read = nir->info.inputs_read; + /* Finally, translate VERT_ATTRIB_* values into the actual registers. */ nir_foreach_function(function, nir) { if (function->impl) { nir_foreach_block(block, function->impl) { - remap_vs_attrs(block, inputs_read); + remap_vs_attrs(block, &nir->info); } } }