#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
namespace sh
{
namespace
{
DynamicIndexingNodeMatcher;
const TType *kIndexType = …;
constexpr const ImmutableString kBaseName("base");
constexpr const ImmutableString kIndexName("index");
constexpr const ImmutableString kValueName("value");
std::string GetIndexFunctionName(const TType &type, bool write)
{ … }
TIntermConstantUnion *CreateIntConstantNode(int i)
{ … }
TIntermTyped *EnsureSignedInt(TIntermTyped *node)
{ … }
TType *GetFieldType(const TType &indexedType)
{ … }
const TType *GetBaseType(const TType &type, bool write)
{ … }
TIntermFunctionDefinition *GetIndexFunctionDefinition(const TType &type,
bool write,
const TFunction &func,
TSymbolTable *symbolTable)
{ … }
class RemoveDynamicIndexingTraverser : public TLValueTrackingTraverser
{ … };
RemoveDynamicIndexingTraverser::RemoveDynamicIndexingTraverser(
DynamicIndexingNodeMatcher &&matcher,
TSymbolTable *symbolTable,
PerformanceDiagnostics *perfDiagnostics)
: … { … }
void RemoveDynamicIndexingTraverser::insertHelperDefinitions(TIntermNode *root)
{ … }
TIntermAggregate *CreateIndexFunctionCall(TIntermBinary *node,
TIntermTyped *index,
TFunction *indexingFunction)
{ … }
TIntermAggregate *CreateIndexedWriteFunctionCall(TIntermBinary *node,
TVariable *index,
TVariable *writtenValue,
TFunction *indexedWriteFunction)
{ … }
bool RemoveDynamicIndexingTraverser::visitBinary(Visit visit, TIntermBinary *node)
{ … }
void RemoveDynamicIndexingTraverser::nextIteration()
{ … }
bool RemoveDynamicIndexingIf(DynamicIndexingNodeMatcher &&matcher,
TCompiler *compiler,
TIntermNode *root,
TSymbolTable *symbolTable,
PerformanceDiagnostics *perfDiagnostics)
{ … }
}
[[nodiscard]] bool RemoveDynamicIndexingOfNonSSBOVectorOrMatrix(
TCompiler *compiler,
TIntermNode *root,
TSymbolTable *symbolTable,
PerformanceDiagnostics *perfDiagnostics)
{ … }
[[nodiscard]] bool RemoveDynamicIndexingOfSwizzledVector(TCompiler *compiler,
TIntermNode *root,
TSymbolTable *symbolTable,
PerformanceDiagnostics *perfDiagnostics)
{ … }
}