From 8bea5aaa149a349af55552f47dc248a327ea7929 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 1 Sep 2020 10:30:17 -0500 Subject: [PATCH] clover: Use args.size() to compute new var locations This is better than using num_uniforms as it guarantees what we want: a mapping from nir_variable to the args vector. Reviewed-by: Karol Herbst Part-of: --- src/gallium/frontends/clover/nir/invocation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp index 8cdef270d6f..0811f1b24be 100644 --- a/src/gallium/frontends/clover/nir/invocation.cpp +++ b/src/gallium/frontends/clover/nir/invocation.cpp @@ -97,6 +97,7 @@ clover_lower_nir_instr(nir_builder *b, nir_instr *instr, void *_state) /* Even though we only place one scalar argument, clover will bind up to * three 32 bit values */ + unsigned location = state->args.size(); state->args.emplace_back(module::argument::scalar, 4, 4, 4, module::argument::zero_ext, module::argument::grid_offset); @@ -106,7 +107,7 @@ clover_lower_nir_instr(nir_builder *b, nir_instr *instr, void *_state) state->offset_vars[i] = nir_variable_create(b->shader, nir_var_uniform, type, "global_invocation_id_offsets"); - state->offset_vars[i]->data.location = b->shader->num_uniforms++; + state->offset_vars[i]->data.location = location + i; } } -- 2.30.2