glsl: Silence a warning at -Og

../src/compiler/glsl/gl_nir_link_uniforms.c:1786:50: warning: ‘blocks’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1786 |             const struct gl_uniform_block *const block =

Just do nothing if we somehow fail to initialize blocks.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>
This commit is contained in:
Adam Jackson 2021-01-26 14:11:04 -05:00 committed by Marge Bot
parent 89acceda60
commit b882857d28
1 changed files with 2 additions and 2 deletions

View File

@ -1651,7 +1651,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
int location = var->data.location;
struct gl_uniform_block *blocks;
struct gl_uniform_block *blocks = NULL;
int num_blocks = 0;
int buffer_block_index = -1;
if (!prog->data->spirv && state.var_is_in_block) {
@ -1729,7 +1729,7 @@ gl_nir_link_uniforms(struct gl_context *ctx,
}
}
if (!prog->data->spirv && state.var_is_in_block) {
if (blocks && !prog->data->spirv && state.var_is_in_block) {
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;