#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include "common/mathutil.h"
#include "common/matrix_utils.h"
#include "common/utilities.h"
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/ImmutableString.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/util.h"
namespace sh
{
namespace
{
const float kPi = …;
const float kDegreesToRadiansMultiplier = …;
const float kRadiansToDegreesMultiplier = …;
TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
{ … }
TConstantUnion *Vectorize(const TConstantUnion &constant, size_t size)
{ … }
void UndefinedConstantFoldingError(const TSourceLoc &loc,
const TFunction *function,
TBasicType basicType,
TDiagnostics *diagnostics,
TConstantUnion *result)
{ … }
float VectorLength(const TConstantUnion *paramArray, size_t paramArraySize)
{ … }
float VectorDotProduct(const TConstantUnion *paramArray1,
const TConstantUnion *paramArray2,
size_t paramArraySize)
{ … }
TIntermTyped *CreateFoldedNode(const TConstantUnion *constArray, const TIntermTyped *originalNode)
{ … }
angle::Matrix<float> GetMatrix(const TConstantUnion *paramArray,
const unsigned int rows,
const unsigned int cols)
{ … }
angle::Matrix<float> GetMatrix(const TConstantUnion *paramArray, const unsigned int size)
{ … }
void SetUnionArrayFromMatrix(const angle::Matrix<float> &m, TConstantUnion *resultArray)
{ … }
bool CanFoldAggregateBuiltInOp(TOperator op)
{ … }
void PropagatePrecisionIfApplicable(TIntermTyped *node, TPrecision precision)
{ … }
}
TIntermExpression::TIntermExpression(const TType &t) : … { … }
#define REPLACE_IF_IS(node, conversionFunc, original, replacement) …
size_t TIntermSymbol::getChildCount() const
{ … }
TIntermNode *TIntermSymbol::getChildNode(size_t index) const
{ … }
size_t TIntermConstantUnion::getChildCount() const
{ … }
TIntermNode *TIntermConstantUnion::getChildNode(size_t index) const
{ … }
size_t TIntermLoop::getChildCount() const
{ … }
TIntermNode *TIntermLoop::getChildNode(size_t index) const
{ … }
bool TIntermLoop::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermBranch::TIntermBranch(const TIntermBranch &node)
: … { … }
size_t TIntermBranch::getChildCount() const
{ … }
TIntermNode *TIntermBranch::getChildNode(size_t index) const
{ … }
bool TIntermBranch::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermSwizzle::getChildCount() const
{ … }
TIntermNode *TIntermSwizzle::getChildNode(size_t index) const
{ … }
bool TIntermSwizzle::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermBinary::getChildCount() const
{ … }
TIntermNode *TIntermBinary::getChildNode(size_t index) const
{ … }
bool TIntermBinary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermUnary::getChildCount() const
{ … }
TIntermNode *TIntermUnary::getChildNode(size_t index) const
{ … }
bool TIntermUnary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermGlobalQualifierDeclaration::getChildCount() const
{ … }
TIntermNode *TIntermGlobalQualifierDeclaration::getChildNode(size_t index) const
{ … }
bool TIntermGlobalQualifierDeclaration::replaceChildNode(TIntermNode *original,
TIntermNode *replacement)
{ … }
size_t TIntermFunctionDefinition::getChildCount() const
{ … }
TIntermNode *TIntermFunctionDefinition::getChildNode(size_t index) const
{ … }
bool TIntermFunctionDefinition::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermAggregate::getChildCount() const
{ … }
TIntermNode *TIntermAggregate::getChildNode(size_t index) const
{ … }
bool TIntermAggregate::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermBlock::TIntermBlock(const TIntermBlock &node)
{ … }
TIntermBlock::TIntermBlock(std::initializer_list<TIntermNode *> stmts)
{ … }
size_t TIntermBlock::getChildCount() const
{ … }
TIntermNode *TIntermBlock::getChildNode(size_t index) const
{ … }
bool TIntermBlock::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
void TIntermBlock::replaceAllChildren(const TIntermSequence &newStatements)
{ … }
size_t TIntermFunctionPrototype::getChildCount() const
{ … }
TIntermNode *TIntermFunctionPrototype::getChildNode(size_t index) const
{ … }
bool TIntermFunctionPrototype::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermDeclaration::TIntermDeclaration(const TVariable *var, TIntermTyped *initExpr)
{ … }
TIntermDeclaration::TIntermDeclaration(std::initializer_list<const TVariable *> declarators)
: … { … }
TIntermDeclaration::TIntermDeclaration(std::initializer_list<TIntermTyped *> declarators)
: … { … }
size_t TIntermDeclaration::getChildCount() const
{ … }
TIntermNode *TIntermDeclaration::getChildNode(size_t index) const
{ … }
bool TIntermDeclaration::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermDeclaration::TIntermDeclaration(const TIntermDeclaration &node)
{ … }
bool TIntermAggregateBase::replaceChildNodeInternal(TIntermNode *original, TIntermNode *replacement)
{ … }
bool TIntermAggregateBase::replaceChildNodeWithMultiple(TIntermNode *original,
const TIntermSequence &replacements)
{ … }
bool TIntermAggregateBase::insertChildNodes(TIntermSequence::size_type position,
const TIntermSequence &insertions)
{ … }
TIntermSymbol::TIntermSymbol(const TVariable *variable) : … { … }
bool TIntermSymbol::hasConstantValue() const
{ … }
const TConstantUnion *TIntermSymbol::getConstantValue() const
{ … }
const TSymbolUniqueId &TIntermSymbol::uniqueId() const
{ … }
ImmutableString TIntermSymbol::getName() const
{ … }
const TType &TIntermSymbol::getType() const
{ … }
void TIntermSymbol::propagatePrecision(TPrecision precision)
{ … }
TIntermAggregate *TIntermAggregate::CreateFunctionCall(const TFunction &func,
TIntermSequence *arguments)
{ … }
TIntermAggregate *TIntermAggregate::CreateRawFunctionCall(const TFunction &func,
TIntermSequence *arguments)
{ … }
TIntermAggregate *TIntermAggregate::CreateBuiltInFunctionCall(const TFunction &func,
TIntermSequence *arguments)
{ … }
TIntermAggregate *TIntermAggregate::CreateConstructor(const TType &type, TIntermSequence *arguments)
{ … }
TIntermAggregate *TIntermAggregate::CreateConstructor(
const TType &type,
const std::initializer_list<TIntermNode *> &arguments)
{ … }
TIntermAggregate::TIntermAggregate(const TFunction *func,
const TType &type,
TOperator op,
TIntermSequence *arguments)
: … { … }
void TIntermAggregate::setPrecisionAndQualifier()
{ … }
bool TIntermAggregate::areChildrenConstQualified()
{ … }
TPrecision TIntermAggregate::derivePrecision() const
{ … }
void TIntermAggregate::propagatePrecision(TPrecision precision)
{ … }
const char *TIntermAggregate::functionName() const
{ … }
bool TIntermAggregate::hasConstantValue() const
{ … }
bool TIntermAggregate::isConstantNullValue() const
{ … }
const TConstantUnion *TIntermAggregate::getConstantValue() const
{ … }
bool TIntermAggregate::hasSideEffects() const
{ … }
void TIntermBlock::appendStatement(TIntermNode *statement)
{ … }
void TIntermBlock::insertStatement(size_t insertPosition, TIntermNode *statement)
{ … }
void TIntermDeclaration::appendDeclarator(TIntermTyped *declarator)
{ … }
size_t TIntermTernary::getChildCount() const
{ … }
TIntermNode *TIntermTernary::getChildNode(size_t index) const
{ … }
bool TIntermTernary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermIfElse::getChildCount() const
{ … }
TIntermNode *TIntermIfElse::getChildNode(size_t index) const
{ … }
bool TIntermIfElse::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
size_t TIntermSwitch::getChildCount() const
{ … }
TIntermNode *TIntermSwitch::getChildNode(size_t index) const
{ … }
bool TIntermSwitch::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermCase::TIntermCase(const TIntermCase &node) : … { … }
size_t TIntermCase::getChildCount() const
{ … }
TIntermNode *TIntermCase::getChildNode(size_t index) const
{ … }
bool TIntermCase::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
{ … }
TIntermTyped::TIntermTyped() : … { … }
TIntermTyped::TIntermTyped(const TIntermTyped &node) : … { … }
bool TIntermTyped::hasConstantValue() const
{ … }
bool TIntermTyped::isConstantNullValue() const
{ … }
const TConstantUnion *TIntermTyped::getConstantValue() const
{ … }
TPrecision TIntermTyped::derivePrecision() const
{ … }
void TIntermTyped::propagatePrecision(TPrecision precision)
{ … }
TIntermConstantUnion::TIntermConstantUnion(const TIntermConstantUnion &node)
: … { … }
TIntermFunctionPrototype::TIntermFunctionPrototype(const TFunction *function)
: … { … }
const TType &TIntermFunctionPrototype::getType() const
{ … }
TIntermAggregate::TIntermAggregate(const TIntermAggregate &node)
: … { … }
TIntermAggregate *TIntermAggregate::shallowCopy() const
{ … }
TIntermSwizzle::TIntermSwizzle(const TIntermSwizzle &node) : … { … }
TIntermBinary::TIntermBinary(const TIntermBinary &node) : … { … }
TIntermUnary::TIntermUnary(const TIntermUnary &node)
: … { … }
TIntermTernary::TIntermTernary(const TIntermTernary &node) : … { … }
bool TIntermOperator::isAssignment() const
{ … }
bool TIntermOperator::isMultiplication() const
{ … }
bool TIntermOperator::isConstructor() const
{ … }
bool TIntermOperator::isFunctionCall() const
{ … }
TOperator TIntermBinary::GetMulOpBasedOnOperands(const TType &left, const TType &right)
{ … }
TOperator TIntermBinary::GetMulAssignOpBasedOnOperands(const TType &left, const TType &right)
{ … }
void TIntermUnary::promote()
{ … }
TPrecision TIntermUnary::derivePrecision() const
{ … }
void TIntermUnary::propagatePrecision(TPrecision precision)
{ … }
TIntermSwizzle::TIntermSwizzle(TIntermTyped *operand, const TVector<int> &swizzleOffsets)
: … { … }
TIntermUnary::TIntermUnary(TOperator op, TIntermTyped *operand, const TFunction *function)
: … { … }
TIntermBinary::TIntermBinary(TOperator op, TIntermTyped *left, TIntermTyped *right)
: … { … }
TIntermBinary *TIntermBinary::CreateComma(TIntermTyped *left,
TIntermTyped *right,
int shaderVersion)
{ … }
TIntermGlobalQualifierDeclaration::TIntermGlobalQualifierDeclaration(TIntermSymbol *symbol,
bool isPrecise,
const TSourceLoc &line)
: … { … }
TIntermGlobalQualifierDeclaration::TIntermGlobalQualifierDeclaration(
const TIntermGlobalQualifierDeclaration &node)
: … { … }
TIntermTernary::TIntermTernary(TIntermTyped *cond,
TIntermTyped *trueExpression,
TIntermTyped *falseExpression)
: … { … }
TIntermLoop::TIntermLoop(TLoopType type,
TIntermNode *init,
TIntermTyped *cond,
TIntermTyped *expr,
TIntermBlock *body)
: … { … }
TIntermLoop::TIntermLoop(const TIntermLoop &node)
: … { … }
TIntermIfElse::TIntermIfElse(TIntermTyped *cond, TIntermBlock *trueB, TIntermBlock *falseB)
: … { … }
TIntermIfElse::TIntermIfElse(const TIntermIfElse &node)
: … { … }
TIntermSwitch::TIntermSwitch(TIntermTyped *init, TIntermBlock *statementList)
: … { … }
TIntermSwitch::TIntermSwitch(const TIntermSwitch &node)
: … { … }
void TIntermSwitch::setStatementList(TIntermBlock *statementList)
{ … }
TQualifier TIntermTernary::DetermineQualifier(TIntermTyped *cond,
TIntermTyped *trueExpression,
TIntermTyped *falseExpression)
{ … }
TPrecision TIntermTernary::derivePrecision() const
{ … }
void TIntermTernary::propagatePrecision(TPrecision precision)
{ … }
TIntermTyped *TIntermTernary::fold(TDiagnostics * )
{ … }
void TIntermSwizzle::promote()
{ … }
TPrecision TIntermSwizzle::derivePrecision() const
{ … }
void TIntermSwizzle::propagatePrecision(TPrecision precision)
{ … }
bool TIntermSwizzle::hasDuplicateOffsets() const
{ … }
void TIntermSwizzle::setHasFoldedDuplicateOffsets(bool hasFoldedDuplicateOffsets)
{ … }
bool TIntermSwizzle::offsetsMatch(int offset) const
{ … }
void TIntermSwizzle::writeOffsetsAsXYZW(TInfoSinkBase *out) const
{ … }
TQualifier TIntermBinary::GetCommaQualifier(int shaderVersion,
const TIntermTyped *left,
const TIntermTyped *right)
{ … }
void TIntermBinary::promote()
{ … }
TPrecision TIntermBinary::derivePrecision() const
{ … }
void TIntermBinary::propagatePrecision(TPrecision precision)
{ … }
bool TIntermConstantUnion::hasConstantValue() const
{ … }
bool TIntermConstantUnion::isConstantNullValue() const
{ … }
const TConstantUnion *TIntermConstantUnion::getConstantValue() const
{ … }
const TConstantUnion *TIntermConstantUnion::FoldIndexing(const TType &type,
const TConstantUnion *constArray,
int index)
{ … }
TIntermTyped *TIntermSwizzle::fold(TDiagnostics * )
{ … }
TIntermTyped *TIntermBinary::fold(TDiagnostics *diagnostics)
{ … }
bool TIntermBinary::hasConstantValue() const
{ … }
const TConstantUnion *TIntermBinary::getConstantValue() const
{ … }
const ImmutableString &TIntermBinary::getIndexStructFieldName() const
{ … }
TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics)
{ … }
TIntermTyped *TIntermAggregate::fold(TDiagnostics *diagnostics)
{ … }
const TConstantUnion *TIntermConstantUnion::FoldBinary(TOperator op,
const TConstantUnion *leftArray,
const TType &leftType,
const TConstantUnion *rightArray,
const TType &rightType,
TDiagnostics *diagnostics,
const TSourceLoc &line)
{ … }
TConstantUnion *TIntermConstantUnion::foldUnaryNonComponentWise(TOperator op)
{ … }
TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
const TFunction *function,
TDiagnostics *diagnostics)
{ … }
void TIntermConstantUnion::foldFloatTypeUnary(const TConstantUnion ¶meter,
FloatTypeUnaryFunc builtinFunc,
TConstantUnion *result) const
{ … }
void TIntermConstantUnion::propagatePrecision(TPrecision precision)
{ … }
TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *aggregate,
TDiagnostics *diagnostics)
{ … }
bool TIntermConstantUnion::IsFloatDivision(TBasicType t1, TBasicType t2)
{ … }
TIntermPreprocessorDirective::TIntermPreprocessorDirective(PreprocessorDirective directive,
ImmutableString command)
: … { … }
TIntermPreprocessorDirective::TIntermPreprocessorDirective(const TIntermPreprocessorDirective &node)
: … { … }
TIntermPreprocessorDirective::~TIntermPreprocessorDirective() = default;
size_t TIntermPreprocessorDirective::getChildCount() const
{ … }
TIntermNode *TIntermPreprocessorDirective::getChildNode(size_t index) const
{ … }
}