st/mesa: use *prog at the end of st_link_nir
authorMarek Olšák <marek.olsak@amd.com>
Fri, 27 Sep 2019 21:28:48 +0000 (17:28 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 17 Oct 2019 00:10:47 +0000 (20:10 -0400)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 22175799cf32fbdd202998577f31fb1414dab0ee..dc6429f5671973147a03f790f57a5f3bfa65ab84 100644 (file)
@@ -806,17 +806,17 @@ st_link_nir(struct gl_context *ctx,
       if (shader == NULL)
          continue;
 
-      st_glsl_to_nir_post_opts(st, shader->Program, shader_program);
+      struct gl_program *prog = shader->Program;
+      st_glsl_to_nir_post_opts(st, prog, shader_program);
 
-      assert(shader->Program);
       if (!ctx->Driver.ProgramStringNotify(ctx,
                                            _mesa_shader_stage_to_program(i),
-                                           shader->Program)) {
+                                           prog)) {
          _mesa_reference_program(ctx, &shader->Program, NULL);
          return false;
       }
 
-      nir_sweep(shader->Program->nir);
+      nir_sweep(prog->nir);
 
       /* The GLSL IR won't be needed anymore. */
       ralloc_free(shader->ir);