nir: add a helper for calculating variable slots

this will maybe avoid future bugs, but probably not

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:24:51 -04:00
committed by Marge Bot
parent 330f728cc4
commit e68e612826
6 changed files with 15 additions and 20 deletions

View File

@@ -71,9 +71,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(var->data.location_frac + glsl_get_length(var->type), 4)
: type_size_vec4(var->type, true);
const unsigned var_vec4s = nir_variable_count_slots(var, var->type);
vec4s[loc] = MAX2(vec4s[loc], var_vec4s);
}