1 //
2 // Copyright 2002 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_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
11 #define COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
12 
13 #include <vector>
14 
15 #include "common/angleutils.h"
16 
17 namespace sh
18 {
19 struct ShaderVariable;
20 class TCompiler;
21 class TIntermBlock;
22 class TSymbolTable;
23 
24 // Replace all gl_FragColor with gl_FragData[0], and in the end of main() function,
25 // assign gl_FragData[1] ... gl_FragData[maxDrawBuffers - 1] with gl_FragData[0].
26 // If gl_FragColor is in outputVariables, it is replaced by gl_FragData.
27 ANGLE_NO_DISCARD bool EmulateGLFragColorBroadcast(TCompiler *compiler,
28                                                   TIntermBlock *root,
29                                                   int maxDrawBuffers,
30                                                   std::vector<ShaderVariable> *outputVariables,
31                                                   TSymbolTable *symbolTable,
32                                                   int shaderVersion);
33 }  // namespace sh
34 
35 #endif  // COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
36