From: Marek Olšák Date: Tue, 23 Jul 2019 23:12:45 +0000 (-0400) Subject: radeonsi/nir: accurately set input_usage_mask for doubles (v2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0993dbcbef1a208b67ad2ce5b8187d41b2df5f61;p=mesa.git radeonsi/nir: accurately set input_usage_mask for doubles (v2) v2: fix doubles Reviewed-by: Timothy Arceri --- diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 96ca344e3cc..512dc00cf21 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -63,14 +63,24 @@ static void gather_intrinsic_load_deref_input_info(const nir_shader *nir, case MESA_SHADER_VERTEX: { unsigned i = var->data.driver_location; unsigned attrib_count = glsl_count_attribute_slots(var->type, false); + uint8_t mask = nir_ssa_def_components_read(&instr->dest.ssa); for (unsigned j = 0; j < attrib_count; j++, i++) { if (glsl_type_is_64bit(glsl_without_array(var->type))) { - /* TODO: set usage mask more accurately for doubles */ - info->input_usage_mask[i] = TGSI_WRITEMASK_XYZW; + unsigned dmask = mask; + + if (glsl_type_is_dual_slot(glsl_without_array(var->type)) && j % 2) + dmask >>= 2; + + dmask <<= var->data.location_frac / 2; + + if (dmask & 0x1) + info->input_usage_mask[i] |= TGSI_WRITEMASK_XY; + if (dmask & 0x2) + info->input_usage_mask[i] |= TGSI_WRITEMASK_ZW; } else { - uint8_t mask = nir_ssa_def_components_read(&instr->dest.ssa); - info->input_usage_mask[i] |= mask << var->data.location_frac; + info->input_usage_mask[i] |= + (mask << var->data.location_frac) & 0xf; } } break;