shader: reshuffle [fb]color_emitted handling

Bundle all the front/back color handling to a single block. It makes
the code slightly easier to follow.

Plus it will allow us to factor out some code with a later commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
Emil Velikov 6 years ago committed by Emil Velikov
parent 7c06cebe11
commit 918c82bed6
  1. 38
      src/vrend_shader.c

@ -5906,15 +5906,9 @@ emit_ios_patch(struct dump_ctx *ctx, const char *prefix, const struct vrend_shad
static void emit_ios_vs(struct dump_ctx *ctx) static void emit_ios_vs(struct dump_ctx *ctx)
{ {
uint32_t i; uint32_t i;
bool fcolor_emitted[2], bcolor_emitted[2];
ctx->num_interps = 0; ctx->num_interps = 0;
if (ctx->key->color_two_side) {
fcolor_emitted[0] = fcolor_emitted[1] = false;
bcolor_emitted[0] = bcolor_emitted[1] = false;
}
for (i = 0; i < ctx->num_inputs; i++) { for (i = 0; i < ctx->num_inputs; i++) {
char postfix[32] = ""; char postfix[32] = "";
if (!ctx->inputs[i].glsl_predefined_no_emit) { if (!ctx->inputs[i].glsl_predefined_no_emit) {
@ -5929,13 +5923,28 @@ static void emit_ios_vs(struct dump_ctx *ctx)
emit_ios_indirect_generics_output(ctx, ""); emit_ios_indirect_generics_output(ctx, "");
if (ctx->key->color_two_side) {
bool fcolor_emitted, bcolor_emitted;
for (i = 0; i < ctx->num_outputs; i++) { for (i = 0; i < ctx->num_outputs; i++) {
if (ctx->key->color_two_side && ctx->outputs[i].sid < 2) { if (ctx->outputs[i].sid >= 2)
continue;
fcolor_emitted = bcolor_emitted = false;
if (ctx->outputs[i].name == TGSI_SEMANTIC_COLOR) if (ctx->outputs[i].name == TGSI_SEMANTIC_COLOR)
fcolor_emitted[ctx->outputs[i].sid] = true; fcolor_emitted = true;
if (ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR) if (ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR)
bcolor_emitted[ctx->outputs[i].sid] = true; bcolor_emitted = true;
if (fcolor_emitted && !bcolor_emitted)
emit_hdrf(ctx, "%sout vec4 ex_bc%d;\n", INTERP_PREFIX, ctx->outputs[i].sid);
if (bcolor_emitted && !fcolor_emitted)
emit_hdrf(ctx, "%sout vec4 ex_c%d;\n", INTERP_PREFIX, ctx->outputs[i].sid);
} }
}
for (i = 0; i < ctx->num_outputs; i++) {
if (!ctx->outputs[i].glsl_predefined_no_emit) { if (!ctx->outputs[i].glsl_predefined_no_emit) {
const char *prefix = ""; const char *prefix = "";
@ -5957,17 +5966,6 @@ static void emit_ios_vs(struct dump_ctx *ctx)
} }
} }
if (ctx->key->color_two_side) {
for (i = 0; i < 2; i++) {
if (fcolor_emitted[i] && !bcolor_emitted[i]) {
emit_hdrf(ctx, "%sout vec4 ex_bc%d;\n", INTERP_PREFIX, i);
}
if (bcolor_emitted[i] && !fcolor_emitted[i]) {
emit_hdrf(ctx, "%sout vec4 ex_c%d;\n", INTERP_PREFIX, i);
}
}
}
emit_winsys_correction(ctx); emit_winsys_correction(ctx);
if (ctx->has_clipvertex) { if (ctx->has_clipvertex) {

Loading…
Cancel
Save