summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_link.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-01-07 18:22:56 -0700
committerAlan Hourihane <alanh@vmware.com>2009-01-09 11:16:37 +0000
commitf8a4ad1aeeef1debe6f206bc30696304edd7704c (patch)
tree11fe07ae10af9ab70e414caf58d0bb6a39cb980a /src/mesa/shader/slang/slang_link.c
parent5727ed130ef1d3adb87de89ea717e07726131f3e (diff)
glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData[]
Diffstat (limited to 'src/mesa/shader/slang/slang_link.c')
-rw-r--r--src/mesa/shader/slang/slang_link.c11
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 3f953d86e7..a68cafc086 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -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 */