shader: reshuffle GS stream output handling

Move the GS stream output handling in a separate loop.

Will allow us to de-duplicate the generic output handling across the
board.

v2: Drop prog_type check (Gert)

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

@ -6140,25 +6140,44 @@ static void emit_ios_geom(struct dump_ctx *ctx)
} }
for (i = 0; i < ctx->num_outputs; i++) { for (i = 0; i < ctx->num_outputs; i++) {
if (!ctx->outputs[i].glsl_predefined_no_emit) { if (!ctx->outputs[i].glsl_predefined_no_emit) {
if (!ctx->outputs[i].stream)
continue;
const char *prefix = ""; const char *prefix = "";
if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC || if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC ||
ctx->outputs[i].name == TGSI_SEMANTIC_COLOR || ctx->outputs[i].name == TGSI_SEMANTIC_COLOR ||
ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR) { ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR) {
ctx->num_interps++; ctx->num_interps++;
/* ugly leave spaces to patch interp in later */
prefix = INTERP_PREFIX; prefix = INTERP_PREFIX;
} }
/* ugly leave spaces to patch interp in later */ emit_hdrf(ctx, "layout (stream = %d) %s%s%sout vec4 %s;\n", ctx->outputs[i].stream, prefix,
ctx->outputs[i].precise ? "precise " : "",
ctx->outputs[i].invariant ? "invariant " : "",
ctx->outputs[i].glsl_name);
}
}
for (i = 0; i < ctx->num_outputs; i++) {
if (!ctx->outputs[i].glsl_predefined_no_emit) {
/* GS stream outputs are handled separately */
if (ctx->outputs[i].stream) if (ctx->outputs[i].stream)
emit_hdrf(ctx, "layout (stream = %d) %s%s%sout vec4 %s;\n", ctx->outputs[i].stream, prefix, continue;
ctx->outputs[i].precise ? "precise " : "",
ctx->outputs[i].invariant ? "invariant " : "", const char *prefix = "";
ctx->outputs[i].glsl_name); if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC ||
else ctx->outputs[i].name == TGSI_SEMANTIC_COLOR ||
emit_ios_generics(ctx, io_out, prefix, &ctx->outputs[i], ctx->outputs[i].name == TGSI_SEMANTIC_BCOLOR) {
ctx->outputs[i].fbfetch_used ? "inout" : "out", ""); ctx->num_interps++;
/* ugly leave spaces to patch interp in later */
prefix = INTERP_PREFIX;
}
emit_ios_generics(ctx, io_out, prefix, &ctx->outputs[i],
ctx->outputs[i].fbfetch_used ? "inout" : "out", "");
} else if (ctx->outputs[i].invariant || ctx->outputs[i].precise) { } else if (ctx->outputs[i].invariant || ctx->outputs[i].precise) {
emit_hdrf(ctx, "%s%s;\n", emit_hdrf(ctx, "%s%s;\n",
ctx->outputs[i].precise ? "precise " : ctx->outputs[i].precise ? "precise " :

Loading…
Cancel
Save