mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 09:30:36 +02:00
nir/lower_io_to_vector: Only call glsl_get_length() on arrays
We assumed that calling it on vectors would return 0 and then did a MAX2(length, 1) to get 1 for vectors. Instead, use a ternary so we don't make assumptions about non-sensical values. Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
This commit is contained in:
parent
5db458eb2d
commit
1e1c450659
1 changed files with 2 additions and 1 deletions
|
|
@ -309,7 +309,8 @@ create_new_io_vars(nir_shader *shader, nir_variable_mode mode,
|
|||
var->type = flat_type;
|
||||
|
||||
nir_shader_add_variable(shader, var);
|
||||
unsigned num_slots = MAX2(glsl_get_length(flat_type), 1);
|
||||
unsigned num_slots =
|
||||
glsl_type_is_array(flat_type) ? glsl_get_length(flat_type) : 1;
|
||||
for (unsigned i = 0; i < num_slots; i++) {
|
||||
for (unsigned j = 0; j < 4; j++)
|
||||
new_vars[loc + i][j] = var;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue