shader: Only swizzle color outputs when RGBA-RGBA swizzling is applied

A shader that writes only depth will have num_outputs > 0, but since
there are no color outputs, we must not add the swizzling.

This fixes silicon city on GLES/crosvm

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: John Bates <jbates@chromium.org>
macos/master
Gert Wollny 3 years ago
parent 41838038c4
commit 8678763abe
  1. 8
      src/vrend_shader.c

@ -2302,9 +2302,13 @@ static void emit_fragment_logicop(const struct dump_ctx *ctx,
static void emit_cbuf_swizzle(const struct dump_ctx *ctx,
struct vrend_glsl_strbufs *glsl_strbufs)
{
int cbuf_id = 0;
for (uint i = 0; i < ctx->num_outputs; i++) {
if (ctx->key->fs.swizzle_output_rgb_to_bgr & (1 << i)) {
emit_buff(glsl_strbufs, "fsout_c%d = fsout_c%d.zyxw;\n", i, i);
if (ctx->outputs[i].name == TGSI_SEMANTIC_COLOR) {
if (ctx->key->fs.swizzle_output_rgb_to_bgr & (1 << cbuf_id)) {
emit_buff(glsl_strbufs, "fsout_c%d = fsout_c%d.zyxw;\n", cbuf_id, cbuf_id);
}
++cbuf_id;
}
}
}

Loading…
Cancel
Save