chromium/third_party/angle/src/compiler/translator/tree_ops/spirv/EmulateFramebufferFetch.cpp

//
// Copyright 2023 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.
//
// EmulateFramebufferFetch.h: Replace input, gl_LastFragData and gl_LastFragColorARM with usages of
// input attachments.
//

#include "compiler/translator/tree_ops/spirv/EmulateFramebufferFetch.h"

#include "common/bitset_utils.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/ImmutableStringBuilder.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/BuiltIn.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include "compiler/translator/tree_util/ReplaceVariable.h"
#include "compiler/translator/tree_util/RunAtTheBeginningOfShader.h"
#include "compiler/translator/util.h"

namespace sh
{
namespace
{
InputAttachmentIndexUsage;

// A traverser that looks at which inout variables exist, which gl_LastFragData indices have been
// used and whether gl_LastFragColorARM is referenced.  It builds a set of indices correspondingly;
// these are input attachment indices the shader may read from.
class InputAttachmentUsageTraverser : public TIntermTraverser
{};

void InputAttachmentUsageTraverser::setInputAttachmentIndex(uint32_t index, const TType *type)
{}

bool InputAttachmentUsageTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
{}

bool InputAttachmentUsageTraverser::visitBinary(Visit visit, TIntermBinary *node)
{}

void InputAttachmentUsageTraverser::visitSymbol(TIntermSymbol *symbol)
{}

ImmutableString GetInputAttachmentName(size_t index)
{}

TBasicType GetBasicTypeForSubpassInput(TBasicType inputType)
{}

// Declare an input attachment variable at a given index.
void DeclareInputAttachmentVariable(TSymbolTable *symbolTable,
                                    const TType &outputType,
                                    size_t index,
                                    InputAttachmentMap *inputAttachmentMapOut,
                                    TIntermSequence *declarationsOut)
{}

// Declare a global variable to hold gl_LastFragData/gl_LastFragColorARM
const TVariable *DeclareLastFragDataGlobalVariable(TCompiler *compiler,
                                                   TIntermBlock *root,
                                                   const TVector<const TType *> &attachmentTypes,
                                                   TIntermSequence *declarationsOut)
{}

// Declare an input attachment for each used index.  Additionally, create a global variable for
// gl_LastFragData and gl_LastFragColorARM if needed.
[[nodiscard]] bool DeclareVariables(TCompiler *compiler,
                                    TIntermBlock *root,
                                    InputAttachmentIndexUsage indexUsage,
                                    bool usesLastFragData,
                                    const TVector<const TType *> &attachmentTypes,
                                    InputAttachmentMap *inputAttachmentMapOut,
                                    const TVariable **lastFragDataOut)
{}

TIntermTyped *CreateSubpassLoadFuncCall(TSymbolTable *symbolTable, const TVariable *inputVariable)
{}

void GatherInoutVariables(TIntermBlock *root, TVector<const TVariable *> *inoutVariablesOut)
{}

void InitializeFromInputAttachment(TSymbolTable *symbolTable,
                                   TIntermBlock *block,
                                   const TVariable *inputVariable,
                                   const TVariable *assignVariable,
                                   uint32_t assignVariableArrayIndex)
{}

[[nodiscard]] bool InitializeFromInputAttachments(TCompiler *compiler,
                                                  TIntermBlock *root,
                                                  const InputAttachmentMap &inputAttachmentMap,
                                                  const TVector<const TVariable *> &inoutVariables,
                                                  const TVariable *lastFragData)
{}

[[nodiscard]] bool ReplaceVariables(TCompiler *compiler,
                                    TIntermBlock *root,
                                    const InputAttachmentMap &inputAttachmentMap,
                                    const TVariable *lastFragData)
{}
}  // anonymous namespace

[[nodiscard]] bool EmulateFramebufferFetch(TCompiler *compiler,
                                           TIntermBlock *root,
                                           InputAttachmentMap *inputAttachmentMapOut)
{}

}  // namespace sh