nir: update ubo locations in nir_lower_uniforms_to_ubo

locations are important for these because they provide info about how
many block indices each ubo takes up

UBO arrays have nonzero values here. all non-array UBOs have either 0
for the base or nonzero for an io lowered block at an offset,
but only arrays need to be changed here because they're the only ones
with absolute values, whereas all the others are relative.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6272>
This commit is contained in:
Mike Blumenkrantz 2020-07-29 19:27:35 -04:00 committed by Marge Bot
parent 47c358233d
commit c31ababae3
1 changed files with 6 additions and 1 deletions

View File

@ -128,8 +128,13 @@ nir_lower_uniforms_to_ubo(nir_shader *shader, int multiplier)
if (progress) {
if (!shader->info.first_ubo_is_default_ubo) {
nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo)
nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo) {
var->data.binding++;
/* only increment location for ubo arrays */
if (glsl_without_array(var->type) == var->interface_type &&
glsl_type_is_array(var->type))
var->data.location++;
}
}
shader->info.num_ubos++;