nir/remove_unused_io_vars: check all components to determine variable liveness

this otherwise only checked the first component

cc: mesa-stable

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28751>
This commit is contained in:
Mike Blumenkrantz 2024-04-15 12:27:19 -04:00 committed by Marge Bot
parent 7d33bab3b4
commit 98ce4a98ae

View file

@ -120,11 +120,6 @@ tcs_add_output_reads(nir_shader *shader, uint64_t *read, uint64_t *patches_read)
* progress = nir_remove_unused_io_vars(producer, nir_var_shader_out,
* read, patches_read) ||
* progress;
*
* The "used" should be an array of 4 uint64_ts (probably of VARYING_BIT_*)
* representing each .location_frac used. Note that for vector variables,
* only the first channel (.location_frac) is examined for deciding if the
* variable is used!
*/
bool
nir_remove_unused_io_vars(nir_shader *shader,
@ -153,7 +148,9 @@ nir_remove_unused_io_vars(nir_shader *shader,
if (var->data.explicit_xfb_buffer)
continue;
uint64_t other_stage = used[var->data.location_frac];
uint64_t other_stage = 0;
for (unsigned i = 0; i < get_num_components(var); i++)
other_stage |= used[var->data.location_frac + i];
if (!(other_stage & get_variable_io_mask(var, shader->info.stage))) {
/* This one is invalid, make it a global variable instead */