1 //
2 // Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // Emulate gl_FragColor broadcast behaviors in ES2 where
7 // GL_EXT_draw_buffers is explicitly enabled in a fragment shader.
8 //
9 
10 #ifndef COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_
11 #define COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_
12 
13 #include <vector>
14 
15 namespace sh
16 {
17 struct OutputVariable;
18 class TIntermNode;
19 
20 // Replace all gl_FragColor with gl_FragData[0], and in the end of main() function,
21 // assign gl_FragData[1] ... gl_FragData[maxDrawBuffers - 1] with gl_FragData[0].
22 // If gl_FragColor is in outputVariables, it is replaced by gl_FragData.
23 void EmulateGLFragColorBroadcast(TIntermNode *root,
24                                  int maxDrawBuffers,
25                                  std::vector<OutputVariable> *outputVariables);
26 }
27 
28 #endif  // COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_
29