From 8678763abec911a98393704d70ac2ce6687d54a2 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 25 Oct 2021 11:29:37 +0200 Subject: [PATCH] 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 Reviewed-by: John Bates --- src/vrend_shader.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 8a87504..dc33cc4 100644 --- a/src/vrend_shader.c +++ b/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; } } }