From 6d7b076166e6a26f68c33ea75b9f9473fc162738 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 26 Feb 2020 17:20:51 -0500 Subject: [PATCH] nir: fix 5 warnings Reviewed-by: Eric Anholt Reviewed-by: Ian Romanick Part-of: --- src/compiler/nir/nir_lower_clip.c | 2 +- src/compiler/nir_types.cpp | 2 +- src/compiler/spirv/vtn_glsl450.c | 2 +- src/gallium/auxiliary/nir/tgsi_to_nir.c | 2 +- src/mesa/state_tracker/st_nir_lower_builtin.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index 0f0d2eb2c73..1e4915e881b 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -466,7 +466,7 @@ bool nir_lower_clip_fs(nir_shader *shader, unsigned ucp_enables, bool use_clipdist_array) { - nir_variable *in[2]; + nir_variable *in[2] = {0}; int maxloc = -1; if (!ucp_enables) diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index 807529fb2b8..36720686eb7 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -657,7 +657,7 @@ glsl_get_natural_size_align_bytes(const struct glsl_type *type, } case GLSL_TYPE_ARRAY: { - unsigned elem_size, elem_align; + unsigned elem_size = 0, elem_align = 0; glsl_get_natural_size_align_bytes(type->fields.array, &elem_size, &elem_align); *align = elem_align; diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index 2d66512bc42..a074b6f3fb4 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -121,7 +121,7 @@ build_mat_subdet(struct nir_builder *b, struct vtn_ssa_value *src, return nir_channel(b, src->elems[1 - col]->def, 1 - row); } else { /* Swizzle to get all but the specified row */ - unsigned swiz[3]; + unsigned swiz[NIR_MAX_VEC_COMPONENTS] = {0}; for (unsigned j = 0; j < 3; j++) swiz[j] = j + (j >= row); diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index fe98bcd980d..6ac894c85bb 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -2302,7 +2302,7 @@ static void ttn_parse_tgsi(struct ttn_compile *c, const void *tgsi_tokens) { struct tgsi_parse_context parser; - int ret; + ASSERTED int ret; ret = tgsi_parse_init(&parser, tgsi_tokens); assert(ret == TGSI_PARSE_OK); diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c b/src/mesa/state_tracker/st_nir_lower_builtin.c index f6f9bf15278..13425d59619 100644 --- a/src/mesa/state_tracker/st_nir_lower_builtin.c +++ b/src/mesa/state_tracker/st_nir_lower_builtin.c @@ -204,7 +204,7 @@ lower_builtin_block(lower_builtin_state *state, nir_block *block) nir_ssa_def *def = nir_load_var(b, new_var); /* swizzle the result: */ - unsigned swiz[4]; + unsigned swiz[NIR_MAX_VEC_COMPONENTS] = {0}; for (unsigned i = 0; i < 4; i++) { swiz[i] = GET_SWZ(element->swizzle, i); assert(swiz[i] <= SWIZZLE_W); -- 2.30.2