st/glsl_to_nir: call post opt functions after opts have finished
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 14 Dec 2017 03:48:49 +0000 (14:48 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 27 Dec 2017 00:26:08 +0000 (11:26 +1100)
We need to move this to a separate loop because
nir_compact_varyings() can alter the IR of a previous stage.

Fixes: 6648bd68fd27 "st/glsl_to_nir: enable NIR link time opts"
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 0ff8dcd68ccda66d5245825729454d5c9a9f6893..b411621ab2ca6ccd9c79c4243ae309ea5cd2f521 100644 (file)
@@ -617,6 +617,12 @@ st_link_nir(struct gl_context *ctx,
                               nir, ctx->API != API_OPENGL_COMPAT);
       }
       prev = i;
+   }
+
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      struct gl_linked_shader *shader = shader_program->_LinkedShaders[i];
+      if (shader == NULL)
+         continue;
 
       st_glsl_to_nir_post_opts(st, shader->Program, shader_program);