Mesa (intel-2008-q4): glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData []

Haihao Xiang haihao at kemper.freedesktop.org
Thu Jan 8 00:52:18 PST 2009


Module: Mesa
Branch: intel-2008-q4
Commit: 9d90e89b42dfe5198b891ec39d22641407d960a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d90e89b42dfe5198b891ec39d22641407d960a7

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan  7 18:22:56 2009 -0700

glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData[]
(cherry picked from commit d1860bcd0ade44a884ac1b7e0c5b2bef8ed6afcb)

---

 src/mesa/shader/slang/slang_link.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 08d7540..eea1a66 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -604,6 +604,17 @@ _slang_link(GLcontext *ctx,
       }         
    }
 
+   /* check that gl_FragColor and gl_FragData are not both written to */
+   if (shProg->FragmentProgram) {
+      GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
+      if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) &&
+          (outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
+         link_error(shProg, "Fragment program cannot write both gl_FragColor"
+                    " and gl_FragData[].\n");
+         return;
+      }         
+   }
+
 
    if (fragProg && shProg->FragmentProgram) {
       /* Compute initial program's TexturesUsed info */



More information about the mesa-commit mailing list