From 7a271151a5d6990c8325008f19ab621d730d06c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 11 May 2011 14:01:17 +0100 Subject: [PATCH] mesa: Don't append fog code for programs that don't output color. Fixes fdo 36919. NOTE: This is a candidate for the stable branches. It should be cherry-picked to the sames branches that 3aa21f93dc1329c6f956277f2746c2a0bdae5446 was. --- src/mesa/program/programopt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c index a239da2c609..c72dfb23b4d 100644 --- a/src/mesa/program/programopt.c +++ b/src/mesa/program/programopt.c @@ -267,6 +267,11 @@ _mesa_append_fog_code(struct gl_context *ctx, return; } + if (!(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR))) { + /* program doesn't output color, so nothing to do */ + return; + } + /* Alloc storage for new instructions */ newInst = _mesa_alloc_instructions(newLen); if (!newInst) { @@ -407,6 +412,7 @@ _mesa_append_fog_code(struct gl_context *ctx, fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; fprog->Base.InputsRead |= FRAG_BIT_FOGC; + assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)); } -- 2.30.2