[virglrenderer-devel] [PATCH] vrend_shader: fix uninitialized variable warning
Gurchetan Singh
gurchetansingh at chromium.org
Thu Aug 2 01:40:44 UTC 2018
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.
---
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 8db42dd557..bc846d1a15 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);
--
2.18.0.597.ga71716f1ad-goog
More information about the virglrenderer-devel
mailing list