summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-28 09:55:15 -0700
committerJordan Justen <[email protected]>2017-09-28 16:19:54 -0700
commit69ed3244d4d9898e5353d34be6a160db409b6dc8 (patch)
treec1cac0d07d6e56f00f8cc5cddb43ef31a1ac27ce /src/mesa
parentce09364d4ec527ceee5be8bf4a08fb27cd2bf152 (diff)
i965/link: Make better use of temporary variables
The way NIR_PASS works (and, by extension, nir_optimize) is that they may clone the shader and throw the old one away. (We use this for testing nir_clone.) It's better if we just make a temporary variable, use it for everything, and re-assign to the gl_program at the end. [[email protected]: Tested NIR_TEST_CLONE=1 with valgrind] Tested-by: Jordan Justen <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 9ddf0230183..80868569ed7 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -297,14 +297,15 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
nir_lower_indirect_derefs(consumer, indirect_mask);
const bool p_is_scalar = compiler->scalar_stage[producer->stage];
- shProg->_LinkedShaders[i]->Program->nir =
- brw_nir_optimize(producer, compiler, p_is_scalar);
+ producer = brw_nir_optimize(producer, compiler, p_is_scalar);
const bool c_is_scalar = compiler->scalar_stage[producer->stage];
- shProg->_LinkedShaders[next]->Program->nir =
- brw_nir_optimize(consumer, compiler, c_is_scalar);
+ consumer = brw_nir_optimize(consumer, compiler, c_is_scalar);
}
+ shProg->_LinkedShaders[i]->Program->nir = producer;
+ shProg->_LinkedShaders[next]->Program->nir = consumer;
+
next = i;
}
}