[Mesa-dev] [PATCH v2 07/73] st/glsl_to_nir: fix the case where NIR clone testing is enabled
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jul 5 10:47:51 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
In that case, prog->nir must be assigned at the end.
---
src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 89f7888..5c4ae81 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -229,21 +229,20 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
assert(pscreen->get_compiler_options); /* drivers using NIR must implement this */
options = (const nir_shader_compiler_options *)
pscreen->get_compiler_options(pscreen, PIPE_SHADER_IR_NIR, ptarget);
assert(options);
if (prog->nir)
return prog->nir;
nir = glsl_to_nir(shader_program, stage, options);
- prog->nir = nir;
NIR_PASS_V(nir, nir_lower_io_to_temporaries,
nir_shader_get_entrypoint(nir),
true, true);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies);
NIR_PASS_V(nir, st_nir_lower_builtin);
NIR_PASS_V(nir, nir_lower_atomics, shader_program);
@@ -274,20 +273,22 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
if (st->ctx->_Shader->Flags & GLSL_DUMP) {
_mesa_log("\n");
_mesa_log("NIR IR for linked %s program %d:\n",
_mesa_shader_stage_to_string(stage),
shader_program->Name);
nir_print_shader(nir, _mesa_get_log_file());
_mesa_log("\n\n");
}
+ prog->nir = nir;
+
return nir;
}
/* TODO any better helper somewhere to sort a list? */
static void
insert_sorted(struct exec_list *var_list, nir_variable *new_var)
{
nir_foreach_variable(var, var_list) {
if (var->data.location > new_var->data.location) {
--
2.9.3
More information about the mesa-dev
mailing list