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 TIntermBlock;
19 class TSymbolTable;
20 
21 // Replace all gl_FragColor with gl_FragData[0], and in the end of main() function,
22 // assign gl_FragData[1] ... gl_FragData[maxDrawBuffers - 1] with gl_FragData[0].
23 // If gl_FragColor is in outputVariables, it is replaced by gl_FragData.
24 void EmulateGLFragColorBroadcast(TIntermBlock *root,
25                                  int maxDrawBuffers,
26                                  std::vector<OutputVariable> *outputVariables,
27                                  TSymbolTable *symbolTable,
28                                  int shaderVersion);
29 }
30 
31 #endif  // COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_
32