Do not broadcast output of gl_FragColor to all attached render targets when…

Do not broadcast output of gl_FragColor to all attached render targets when using a GLES 3.0 context. TRAC #22704 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2102 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c347152c
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "libGLESv2/Program.h" #include "libGLESv2/Program.h"
#include "libGLESv2/renderer/Renderer.h" #include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/VertexDataManager.h" #include "libGLESv2/renderer/VertexDataManager.h"
#include "libGLESv2/Context.h"
#undef near #undef near
#undef far #undef far
...@@ -1583,9 +1584,14 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, int registers, const Varying ...@@ -1583,9 +1584,14 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, int registers, const Varying
"\n" "\n"
" PS_OUTPUT output;\n"; " PS_OUTPUT output;\n";
// Two cases when writing to gl_FragColor and using ESSL 1.0:
// - with a 3.0 context, the output color is copied to channel 0
// - with a 2.0 context using EXT_draw_buffers, the output color is broadcast to all channels
const bool broadcast = fragmentShader->mUsesFragColor && mRenderer->getCurrentClientVersion() < 3;
for (unsigned int i = 0; i < renderTargetCount; i++) for (unsigned int i = 0; i < renderTargetCount; i++)
{ {
unsigned int sourceColor = fragmentShader->mUsesFragData ? i : 0; unsigned int sourceColor = !broadcast ? i : 0;
pixelHLSL += " output.gl_Color" + str(i) + " = gl_Color[" + str(sourceColor) + "];\n"; pixelHLSL += " output.gl_Color" + str(i) + " = gl_Color[" + str(sourceColor) + "];\n";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment