chromium/third_party/angle/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp

//
// Copyright 2002 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// gl_FragColor needs to broadcast to all color buffers in ES2 if
// GL_EXT_draw_buffers is explicitly enabled in a fragment shader.
//
// We emulate this by replacing all gl_FragColor with gl_FragData[0], and in the end
// of main() function, assigning gl_FragData[1], ..., gl_FragData[maxDrawBuffers-1]
// with gl_FragData[0].
//
// Similar replacement applies to gl_SecondaryFragColorEXT if it is used.
//

#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h"

#include "compiler/translator/Compiler.h"
#include "compiler/translator/Symbol.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include "compiler/translator/tree_util/RunAtTheEndOfShader.h"

namespace sh
{

namespace
{

constexpr const ImmutableString kGlFragDataString("gl_FragData");
constexpr const ImmutableString kGlSecondaryFragDataString("gl_SecondaryFragDataEXT");

class GLFragColorBroadcastTraverser : public TIntermTraverser
{};

TIntermBinary *GLFragColorBroadcastTraverser::constructGLFragDataNode(int index,
                                                                      bool secondary) const
{}

TIntermBinary *GLFragColorBroadcastTraverser::constructGLFragDataAssignNode(int index,
                                                                            bool secondary) const
{}

void GLFragColorBroadcastTraverser::visitSymbol(TIntermSymbol *node)
{}

bool GLFragColorBroadcastTraverser::broadcastGLFragColor(TCompiler *compiler, TIntermBlock *root)
{}

}  // namespace

bool EmulateGLFragColorBroadcast(TCompiler *compiler,
                                 TIntermBlock *root,
                                 int maxDrawBuffers,
                                 int maxDualSourceDrawBuffers,
                                 std::vector<sh::ShaderVariable> *outputVariables,
                                 TSymbolTable *symbolTable,
                                 int shaderVersion)
{}

}  // namespace sh