From: José Fonseca Date: Wed, 11 May 2011 13:01:17 +0000 (+0100) Subject: mesa: Don't append fog code for programs that don't output color. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a271151a5d6990c8325008f19ab621d730d06c4;p=mesa.git 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. --- 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)); }