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 <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
/* Even though we only place one scalar argument, clover will bind up to
* three 32 bit values
*/
/* 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);
state->args.emplace_back(module::argument::scalar, 4, 4, 4,
module::argument::zero_ext,
module::argument::grid_offset);
state->offset_vars[i] =
nir_variable_create(b->shader, nir_var_uniform, type,
"global_invocation_id_offsets");
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;