Mesa (master): mesa: Don't append fog code for programs that don' t output color.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed May 11 13:07:21 UTC 2011


Module: Mesa
Branch: master
Commit: 7a271151a5d6990c8325008f19ab621d730d06c4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a271151a5d6990c8325008f19ab621d730d06c4

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed May 11 14:01:17 2011 +0100

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 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index a239da2..c72dfb2 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));
 }
 
 




More information about the mesa-commit mailing list