nir: fix slot calculations for compact variables with location_frac

a variable with a component offset may span multiple slots, and this cannot
be inferred from its type alone (e.g., compacted clip+cull distances)

cc: mesa-stable

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24163>
This commit is contained in:
Mike Blumenkrantz
2023-07-14 12:18:05 -04:00
committed by Marge Bot
parent 42021b4d13
commit 59396eefe6
5 changed files with 7 additions and 7 deletions

View File

@@ -72,7 +72,7 @@ fs_visitor::nir_setup_outputs()
nir_foreach_shader_out_variable(var, nir) {
const int loc = var->data.driver_location;
const unsigned var_vec4s =
var->data.compact ? DIV_ROUND_UP(glsl_get_length(var->type), 4)
var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(var->type), 4)
: type_size_vec4(var->type, true);
vec4s[loc] = MAX2(vec4s[loc], var_vec4s);
}