From 610fb0e19cb5eb83677b485bb931e3f71e976f4d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 19 Nov 2019 16:35:59 -0500 Subject: [PATCH] st/mesa: call nir_sweep in st_finalize_nir This is invoked sooner before (pre-)compiling the first variant and is also applied to fixed-func and ARB programs. --- src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 -- src/mesa/state_tracker/st_program.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index a236908c1b1..27ad14518a1 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -821,8 +821,6 @@ st_link_nir(struct gl_context *ctx, return false; } - nir_sweep(prog->nir); - /* The GLSL IR won't be needed anymore. */ ralloc_free(shader->ir); shader->ir = NULL; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 62d4de3d5b5..12061ed91f1 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -2064,6 +2064,9 @@ st_finalize_program(struct st_context *st, struct gl_program *prog) st->dirty |= ((struct st_program *)prog)->affected_states; } + if (prog->nir) + nir_sweep(prog->nir); + /* Create Gallium shaders now instead of on demand. */ if (ST_DEBUG & DEBUG_PRECOMPILE || st->shader_has_one_variant[prog->info.stage]) -- 2.30.2