From 711bd28d3900fcad36344c545bbc1a842f4cbd7a Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 14 Mar 2019 11:43:13 +0000 Subject: [PATCH] shader: simplify pre and postfixes in emit_ios_vs() v2: use "" to initialize the fixed size char array (Gert) Signed-off-by: Emil Velikov Reviewed-By: Gert Wollny --- src/vrend_shader.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index ee86016..e2ce090 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -5906,8 +5906,6 @@ emit_ios_patch(struct dump_ctx *ctx, const char *prefix, const struct vrend_shad static void emit_ios_vs(struct dump_ctx *ctx) { uint32_t i; - char postfix[32]; - const char *prefix = "", *auxprefix = ""; bool fcolor_emitted[2], bcolor_emitted[2]; ctx->num_interps = 0; @@ -5918,16 +5916,14 @@ static void emit_ios_vs(struct dump_ctx *ctx) } for (i = 0; i < ctx->num_inputs; i++) { + char postfix[32] = ""; if (!ctx->inputs[i].glsl_predefined_no_emit) { if (ctx->cfg->use_explicit_locations) { emit_hdrf(ctx, "layout(location=%d) ", ctx->inputs[i].first); } - prefix = ""; - auxprefix = ""; - postfix[0] = 0; if (ctx->inputs[i].first != ctx->inputs[i].last) snprintf(postfix, sizeof(postfix), "[%d]", ctx->inputs[i].last - ctx->inputs[i].first + 1); - emit_hdrf(ctx, "%s%sin vec4 %s%s;\n", prefix, auxprefix, ctx->inputs[i].glsl_name, postfix); + emit_hdrf(ctx, "in vec4 %s%s;\n", ctx->inputs[i].glsl_name, postfix); } } @@ -5942,13 +5938,13 @@ static void emit_ios_vs(struct dump_ctx *ctx) } if (!ctx->outputs[i].glsl_predefined_no_emit) { + const char *prefix = ""; if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC || ctx->outputs[i].name == TGSI_SEMANTIC_COLOR || ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR) { ctx->num_interps++; prefix = INTERP_PREFIX; - } else - prefix = ""; + } emit_ios_generics(ctx, io_out, prefix, &ctx->outputs[i], ctx->outputs[i].fbfetch_used ? "inout" : "out", "");