vrend_shader: fix uninitialized variable warning

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 <tomeu.vizoso@collabora.com>
macos/master
Gurchetan Singh 6 years ago committed by Dave Airlie
parent f32948d782
commit d9fee3c228
  1. 12
      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; bcolor_emitted[0] = bcolor_emitted[1] = false;
} }
if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT) { 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)) { if (fs_emit_layout(ctx)) {
bool upper_left = !(ctx->fs_coord_origin ^ ctx->key->invert_fs_origin); bool upper_left = !(ctx->fs_coord_origin ^ ctx->key->invert_fs_origin);
char comma = (upper_left && ctx->fs_pixel_center) ? ',' : ' '; 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); snprintf(buf, 255, "%s%sin vec4 %s%s;\n", prefix, auxprefix, ctx->inputs[i].glsl_name, postfix);
STRCAT_WITH_RET(glsl_hdr, buf); 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) { if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL) {
snprintf(buf, 255, "layout(vertices = %d) out;\n", ctx->tcs_vertices_out); snprintf(buf, 255, "layout(vertices = %d) out;\n", ctx->tcs_vertices_out);

Loading…
Cancel
Save