mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-02 14:43:59 +08:00
zink: fix add_derefs case for compact arrays
only compact arrays use the aoa size as the vector length
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28466>
(cherry picked from commit 2185da6c89
)
This commit is contained in:
parent
f08cb1aa44
commit
b87c4de1b6
@ -3974,7 +3974,7 @@
|
||||
"description": "zink: fix add_derefs case for compact arrays",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
@ -3631,6 +3631,8 @@ add_derefs_instr(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
||||
bool is_interp = false;
|
||||
if (!filter_io_instr(intr, &is_load, &is_input, &is_interp))
|
||||
return false;
|
||||
bool is_special_io = (b->shader->info.stage == MESA_SHADER_VERTEX && is_input) ||
|
||||
(b->shader->info.stage == MESA_SHADER_FRAGMENT && !is_input);
|
||||
unsigned loc = nir_intrinsic_io_semantics(intr).location;
|
||||
nir_src *src_offset = nir_get_io_offset_src(intr);
|
||||
const unsigned slot_offset = src_offset && nir_src_is_const(*src_offset) ? nir_src_as_uint(*src_offset) : 0;
|
||||
@ -3659,9 +3661,8 @@ add_derefs_instr(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
||||
bool is_struct = glsl_type_is_struct(glsl_without_array(type));
|
||||
if (is_struct)
|
||||
size = get_slot_components(var, var->data.location + slot_offset, var->data.location);
|
||||
else if ((var->data.mode == nir_var_shader_out && var->data.location < VARYING_SLOT_VAR0) ||
|
||||
(var->data.mode == nir_var_shader_in && var->data.location < (b->shader->info.stage == MESA_SHADER_VERTEX ? VERT_ATTRIB_GENERIC0 : VARYING_SLOT_VAR0)))
|
||||
size = glsl_type_is_array(type) ? glsl_get_aoa_size(type) : glsl_get_vector_elements(type);
|
||||
else if (!is_special_io && var->data.compact)
|
||||
size = glsl_get_aoa_size(type);
|
||||
else
|
||||
size = glsl_get_vector_elements(glsl_without_array(type));
|
||||
assert(size);
|
||||
|
Loading…
Reference in New Issue
Block a user