From d9fee3c228d1b6960170655d6c5e6bab70b90f33 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 1 Aug 2018 18:40:44 -0700 Subject: [PATCH] vrend_shader: fix uninitialized variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This warning was encountered: vrend_shader.c:4257:57: warning: ā€˜iā€™ may be used uninitialized in this function [-Wmaybe-uninitialized] (ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) { Fix this. Reviewed-by: Tomeu Vizoso --- src/vrend_shader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 8db42dd..bc846d1 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -4252,12 +4252,6 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) bcolor_emitted[0] = bcolor_emitted[1] = false; } if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT) { - if (ctx->cfg->use_gles && - (ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) { - snprintf(buf, 255, "uniform float winsys_adjust_y;\n"); - STRCAT_WITH_RET(glsl_hdr, buf); - } - if (fs_emit_layout(ctx)) { bool upper_left = !(ctx->fs_coord_origin ^ ctx->key->invert_fs_origin); char comma = (upper_left && ctx->fs_pixel_center) ? ',' : ' '; @@ -4349,6 +4343,12 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) snprintf(buf, 255, "%s%sin vec4 %s%s;\n", prefix, auxprefix, ctx->inputs[i].glsl_name, postfix); STRCAT_WITH_RET(glsl_hdr, buf); } + + if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT && ctx->cfg->use_gles && + (ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) { + snprintf(buf, 255, "uniform float winsys_adjust_y;\n"); + STRCAT_WITH_RET(glsl_hdr, buf); + } } if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL) { snprintf(buf, 255, "layout(vertices = %d) out;\n", ctx->tcs_vertices_out);