radeonsi/nir: call radeonsi nir opts before the scan pass
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 25 Apr 2019 07:02:51 +0000 (17:02 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 30 Apr 2019 23:41:07 +0000 (09:41 +1000)
Some of the opts are not called in the general optimastion loop
in the state trackers glsl -> nir conversion. We need to call
the radeonsi specific optimisation once before scanning over
the nir otherwise we can end up gathering info on code that
is later removed.

Fixes an assert in the piglit test:

./bin/varying-struct-centroid_gles3

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 541d7e6f11869d36960fd72a0ce2bdd1f2726338..f1a433b72df21d5baa7496f94a25fceaeed54d2b 100644 (file)
@@ -106,6 +106,7 @@ static void si_create_compute_state_async(void *job, int thread_index)
                assert(program->ir_type == PIPE_SHADER_IR_NIR);
                sel.nir = program->ir.nir;
 
+               si_nir_opts(sel.nir);
                si_nir_scan_shader(sel.nir, &sel.info);
                si_lower_nir(&sel);
        }
index 55df95477d39b9a026023d54edb2094d3f08df2b..db4c77da2ff5e7020285c30b1e6950e317c7b762 100644 (file)
@@ -2247,6 +2247,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
 
                sel->nir = state->ir.nir;
 
+               si_nir_opts(sel->nir);
                si_nir_scan_shader(sel->nir, &sel->info);
                si_nir_scan_tess_ctrl(sel->nir, &sel->tcs_info);
        }