glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData[]
authorBrian Paul <brianp@vmware.com>
Thu, 8 Jan 2009 01:22:56 +0000 (18:22 -0700)
committerAlan Hourihane <alanh@vmware.com>
Fri, 9 Jan 2009 11:16:37 +0000 (11:16 +0000)
src/mesa/shader/slang/slang_link.c

index 3f953d86e74d8bd617f96607d2436db0c3bddc95..a68cafc0865a7cf9ef214859c7771d97c6390cd6 100644 (file)
@@ -644,6 +644,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 */