i965/link: Use prog->nir instead of creating a temporary
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Sep 2017 16:58:59 +0000 (09:58 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 28 Sep 2017 23:20:41 +0000 (16:20 -0700)
This way, when NIR_PASS_V makes a clone of the shader (for testing
nir_clone), the new and lowered version gets re-assigned to prog->nir.

[jordan.l.justen@intel.com: Tested NIR_TEST_CLONE=1 with valgrind]
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_link.cpp

index dd6f895db07243455a074f4500c55981115a2084..1fe5ad66f54ee90d6a08ab608f93d43841472791 100644 (file)
@@ -316,11 +316,10 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
          continue;
 
       struct gl_program *prog = shader->Program;
-      nir_shader *nir = shader->Program->nir;
-      brw_shader_gather_info(nir, prog);
+      brw_shader_gather_info(prog->nir, prog);
 
-      NIR_PASS_V(nir, nir_lower_samplers, shProg);
-      NIR_PASS_V(nir, nir_lower_atomics, shProg);
+      NIR_PASS_V(prog->nir, nir_lower_samplers, shProg);
+      NIR_PASS_V(prog->nir, nir_lower_atomics, shProg);
 
       infos[stage] = &prog->nir->info;