From 6446e90e866888cb3e3f3bfcf1c3ae51cfaa6579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 4 Oct 2013 22:40:51 +0200 Subject: [PATCH] st/mesa: write all colorbuffers if gl_FragData[0] is written --- src/mesa/state_tracker/st_program.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 60cc37c..74da940 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -674,8 +674,6 @@ st_translate_fragment_program(struct st_context *st, /* handled above */ assert(0); break; - case FRAG_RESULT_COLOR: - write_all = GL_TRUE; /* fallthrough */ default: assert(attr == FRAG_RESULT_COLOR || (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); @@ -689,6 +687,17 @@ st_translate_fragment_program(struct st_context *st, fs_num_outputs++; } } + + /* At this point, only color outputs should be set. */ + if (outputsWritten == (1 << FRAG_RESULT_COLOR)) + write_all = TRUE; + + /* If just gl_FragData[0] is written, the other colorbuffers are undefined + * according to the spec. Unfortunately, some apps expect the output is + * written to all colorbuffers. + */ + if (outputsWritten == (1 << FRAG_RESULT_DATA0)) + write_all = TRUE; } ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); -- 1.8.1.2