summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-23 19:12:45 -0400
committerMarek Olšák <[email protected]>2019-07-30 22:06:23 -0400
commit0993dbcbef1a208b67ad2ce5b8187d41b2df5f61 (patch)
treea82a13d06ea41822a7e31ac7bf29eb8d25cd20fc /src
parent56e3c70b56997f3d3861e994b22e7b770c5a4da8 (diff)
radeonsi/nir: accurately set input_usage_mask for doubles (v2)
v2: fix doubles Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c18
1 files changed, 14 insertions, 4 deletions
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;