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 // Similarly replace all gl_SecondaryFragColorEXT with gl_SecondaryFragDataEXT[0]. 28 [[nodiscard]] bool EmulateGLFragColorBroadcast(TCompiler *compiler, 29 TIntermBlock *root, 30 int maxDrawBuffers, 31 int maxDualSourceDrawBuffers, 32 std::vector<ShaderVariable> *outputVariables, 33 TSymbolTable *symbolTable, 34 int shaderVersion); 35 } // namespace sh 36 37 #endif // COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_ 38