aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2019-02-25 13:34:09 +0200
committerTapani Pälli <[email protected]>2019-02-26 09:00:36 +0200
commit1d5e5ec30a6c585fbcb3cc9e5b9c2b3e3392d940 (patch)
tree91ee2e7abb7fd00f930e25ffe7b7e0b74a945d76
parent22267feff1a35c4b6f1f0cb9c8e371727f99b5d6 (diff)
nir: use nir_variable_create instead of open-coding the logic
Fixes: 3d7611e9 "st/nir: use NIR for asm programs" Reported-by: Matthias Lorenz <[email protected]> Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/mesa/program/prog_to_nir.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 1c9d0018d55..aa4f2aaf72a 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -1012,13 +1012,11 @@ prog_to_nir(const struct gl_program *prog,
s = c->build.shader;
if (prog->Parameters->NumParameters > 0) {
- c->parameters = rzalloc(s, nir_variable);
- c->parameters->type =
+ const struct glsl_type *type =
glsl_array_type(glsl_vec4_type(), prog->Parameters->NumParameters, 0);
- c->parameters->name = strdup(prog->Parameters->Parameters[0].Name);
- c->parameters->data.read_only = true;
- c->parameters->data.mode = nir_var_uniform;
- exec_list_push_tail(&s->uniforms, &c->parameters->node);
+ c->parameters =
+ nir_variable_create(s, nir_var_uniform, type,
+ prog->Parameters->Parameters[0].Name);
}
setup_registers_and_variables(c);