mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 06:20:19 +01:00
glsl: Make sure that the variable is a ir_variable before unreferencing it
While it technically was already only using an ir_instruction field, better make sure that it is effectively an ir_variable using the dedicated method instead of relying on an undefined behavior. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26144>
This commit is contained in:
parent
d9c4ccf56d
commit
68f5277887
1 changed files with 3 additions and 2 deletions
|
|
@ -36,8 +36,9 @@ void
|
|||
optimize_dead_builtin_variables(exec_list *instructions,
|
||||
enum ir_variable_mode other)
|
||||
{
|
||||
foreach_in_list_safe(ir_variable, var, instructions) {
|
||||
if (var->ir_type != ir_type_variable || var->data.used)
|
||||
foreach_in_list_safe(ir_instruction, inst, instructions) {
|
||||
ir_variable *var = inst->as_variable();
|
||||
if (!var || var->data.used)
|
||||
continue;
|
||||
|
||||
if (var->data.mode != ir_var_uniform
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue