From c5bdadd366c67a47dc4c569588254c1c59d81953 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 9 Mar 2018 15:11:43 +1000 Subject: [PATCH] vrend: only emit alpha test if something writes to mrt 0 The piglit test generates a failed to compile shader: gl-2.1-fbo-mrt-alphatest-no-buffer-zero-write The test never validates any result as it can't, but this fixes the debug logging of the error on the host. --- src/vrend_shader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index fd38478..a71890b 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -835,6 +835,14 @@ static int emit_alpha_test(struct dump_ctx *ctx) char comp_buf[128]; char *sret; + if (!ctx->num_outputs) + return 0; + + if (!ctx->write_all_cbufs) { + /* only emit alpha stanza if first output is 0 */ + if (ctx->outputs[0].sid != 0) + return 0; + } switch (ctx->key->alpha_test) { case PIPE_FUNC_NEVER: case PIPE_FUNC_ALWAYS: