v3d: fix array_len when precompiling outputs for shader-db

Since 68c54c994a glsl_get_length returns the number of
vector elements for vectors, which is not what we want here.

This was causing us to blow up the number of output variables
during shader-db runs, causing all kinds of problems.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28978>
This commit is contained in:
Iago Toral Quiroga
2024-05-07 10:11:46 +02:00
parent ae7f20d8d4
commit 989cfb6035
+2 -1
View File
@@ -196,7 +196,8 @@ precompile_all_outputs(nir_shader *s,
uint8_t *num_outputs)
{
nir_foreach_shader_out_variable(var, s) {
const int array_len = MAX2(glsl_get_length(var->type), 1);
const int array_len = glsl_type_is_vector_or_scalar(var->type) ?
1 : MAX2(glsl_get_length(var->type), 1);
for (int j = 0; j < array_len; j++) {
const int slot = var->data.location + j;
const int num_components =