From: Brian Paul Date: Thu, 8 Jan 2009 01:22:56 +0000 (-0700) Subject: glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData[] X-Git-Tag: mesa-7.8~4139^2~496^2~126^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8a4ad1aeeef1debe6f206bc30696304edd7704c;p=platform%2Fupstream%2Fmesa.git glsl: check that the fragment shader does not write both gl_FragColor and gl_FragData[] --- diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 3f953d8..a68cafc 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 */