mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 00:10:10 +01:00
glsl: fix up location setting for variables pointing to a UBO's base
while linking uniforms, we might get a variable which is the only reference to the ubo (i.e., offset 0), as determined by its type being the UBO's interface_type, at which point we can assign the previously-gotten block index to this variable's location Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5831>
This commit is contained in:
parent
ef0babab38
commit
47c358233d
1 changed files with 47 additions and 44 deletions
|
|
@ -1727,9 +1727,9 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prog->data->spirv && state.var_is_in_block &&
|
if (!prog->data->spirv && state.var_is_in_block) {
|
||||||
glsl_without_array(state.current_var->type) != state.current_var->interface_type) {
|
if (glsl_without_array(state.current_var->type) != state.current_var->interface_type) {
|
||||||
|
/* this is nested at some offset inside the block */
|
||||||
bool found = false;
|
bool found = false;
|
||||||
char sentinel = '\0';
|
char sentinel = '\0';
|
||||||
|
|
||||||
|
|
@ -1774,7 +1774,10 @@ gl_nir_link_uniforms(struct gl_context *ctx,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert(found);
|
assert(found);
|
||||||
|
} else
|
||||||
|
/* this is the base block offset */
|
||||||
|
location = buffer_block_index;
|
||||||
|
assert(buffer_block_index >= 0);
|
||||||
const struct gl_uniform_block *const block =
|
const struct gl_uniform_block *const block =
|
||||||
&blocks[buffer_block_index];
|
&blocks[buffer_block_index];
|
||||||
assert(location != -1);
|
assert(location != -1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue