microsoft/compiler: Don't split loads/stores that will be split by lower_explicit_io

Otherwise we can end up splitting push constant loads, which currently require
an unbroken (no-cast) deref chain up to the variable.

Fixes: 4c527f4f ("spirv2dxil: Lower unaligned loads and stores")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22371>
This commit is contained in:
Jesse Natalie
2023-04-07 16:39:23 -07:00
committed by Marge Bot
parent 642a88df3d
commit 01ccba0d8e
+6 -2
View File
@@ -2253,9 +2253,13 @@ dxil_nir_split_unaligned_loads_stores(nir_shader *shader, nir_variable_mode mode
val = intrin->src[1].ssa;
}
unsigned natural_alignment =
val->bit_size / 8 *
unsigned scalar_byte_size = glsl_type_is_boolean(deref->type) ? 4 : glsl_get_bit_size(deref->type) / 8;
unsigned num_components =
/* If the vector stride is larger than the scalar size, lower_explicit_io will
* turn this into multiple scalar loads anyway, so we don't have to split it here. */
glsl_get_explicit_stride(deref->type) > scalar_byte_size ? 1 :
(val->num_components == 3 ? 4 : val->num_components);
unsigned natural_alignment = scalar_byte_size * num_components;
if (alignment >= natural_alignment)
continue;