summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-05-11 14:01:17 +0100
committerJosé Fonseca <[email protected]>2011-05-11 14:04:08 +0100
commit7a271151a5d6990c8325008f19ab621d730d06c4 (patch)
tree00cdf8154fd1e00a9254fbfdf99d80a33314972f
parent2812b60a84a2992516db28b37b305c2a7eb5f424 (diff)
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.
-rw-r--r--src/mesa/program/programopt.c6
1 files changed, 6 insertions, 0 deletions
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));
}