Commit 382bf288 by Shahbaz Youssefi Committed by Commit Bot

Organize AST transforms per backend

Most of the AST transforms are written as a workaround to an issue that affects a single backend. This change identifies such transforms and organizes them by backend. They are then only built if the respective backend is. Additionally, about half of the GL transforms are due to mac workarounds, including the large RewriteRowMajorMatrices transform. Mac-specific workarounds are additionally only built on said platform. This change reduces the ANGLE binary size: - 106KB in a Vulkan-only build on Linux - 27KB in a GL-only build on Android (60KB on Linux) Bug: chromium:1084580 Bug: chromium:1161513 Change-Id: I64b334332c0d4f848756c6538af0d8d96864c7e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2601346 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent b590fd1b
......@@ -472,13 +472,22 @@ angle_static_library("translator") {
sources = angle_translator_sources
defines = []
_needs_glsl_base = false
needs_glsl_and_vulkan_base = false
if (angle_enable_essl || use_fuzzing_engine) {
_needs_glsl_base = true
sources += angle_translator_essl_sources
defines += [ "ANGLE_ENABLE_ESSL" ]
}
if (angle_enable_glsl || use_fuzzing_engine) {
_needs_glsl_base = true
needs_glsl_and_vulkan_base = true
sources += angle_translator_glsl_sources
if (is_mac || is_ios) {
sources += angle_translator_glsl_mac_sources
}
defines += [ "ANGLE_ENABLE_GLSL" ]
}
......@@ -488,10 +497,20 @@ angle_static_library("translator") {
}
if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
_needs_glsl_base = true
needs_glsl_and_vulkan_base = true
# This translator is needed by metal backend also.
sources += angle_translator_lib_vulkan_sources
}
if (_needs_glsl_base) {
sources += angle_translator_glsl_base_sources
}
if (needs_glsl_and_vulkan_base) {
sources += angle_translator_glsl_and_vulkan_base_sources
}
if (angle_enable_vulkan || use_fuzzing_engine) {
defines += [ "ANGLE_ENABLE_VULKAN" ]
}
......
......@@ -119,8 +119,6 @@ declare_args() {
# Disable null backend to save space for official build.
angle_enable_null = !is_official_build
angle_enable_essl = true
angle_enable_glsl = true
angle_enable_gl_desktop = !is_android && !is_ios
# http://anglebug.com/2634
......@@ -135,6 +133,8 @@ declare_args() {
angle_enable_vulkan && !is_android && !is_fuchsia && !is_ggp
angle_enable_hlsl = angle_enable_d3d9 || angle_enable_d3d11
angle_enable_essl = angle_enable_gl || use_ozone
angle_enable_glsl = angle_enable_gl || use_ozone
angle_enable_trace = false
angle_enable_trace_android_logcat = false
......
......@@ -21,12 +21,9 @@
#include "compiler/translator/ValidateOutputs.h"
#include "compiler/translator/ValidateVaryingLocations.h"
#include "compiler/translator/VariablePacker.h"
#include "compiler/translator/tree_ops/AddAndTrueToLoopCondition.h"
#include "compiler/translator/tree_ops/ClampFragDepth.h"
#include "compiler/translator/tree_ops/ClampPointSize.h"
#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h"
#include "compiler/translator/tree_ops/DeferGlobalInitializers.h"
#include "compiler/translator/tree_ops/EarlyFragmentTestsOptimization.h"
#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h"
#include "compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h"
#include "compiler/translator/tree_ops/EmulatePrecision.h"
......@@ -35,21 +32,24 @@
#include "compiler/translator/tree_ops/InitializeVariables.h"
#include "compiler/translator/tree_ops/PruneEmptyCases.h"
#include "compiler/translator/tree_ops/PruneNoOps.h"
#include "compiler/translator/tree_ops/RegenerateStructNames.h"
#include "compiler/translator/tree_ops/RemoveArrayLengthMethod.h"
#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h"
#include "compiler/translator/tree_ops/RemoveInvariantDeclaration.h"
#include "compiler/translator/tree_ops/RemovePow.h"
#include "compiler/translator/tree_ops/RemoveUnreferencedVariables.h"
#include "compiler/translator/tree_ops/RewriteDoWhile.h"
#include "compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h"
#include "compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h"
#include "compiler/translator/tree_ops/SeparateDeclarations.h"
#include "compiler/translator/tree_ops/SimplifyLoopConditions.h"
#include "compiler/translator/tree_ops/SplitSequenceOperator.h"
#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h"
#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h"
#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
#include "compiler/translator/tree_ops/gl/ClampFragDepth.h"
#include "compiler/translator/tree_ops/gl/RewriteRepeatedAssignToSwizzled.h"
#include "compiler/translator/tree_ops/gl/UseInterfaceBlockFields.h"
#include "compiler/translator/tree_ops/gl/VectorizeVectorScalarArithmetic.h"
#include "compiler/translator/tree_ops/gl/mac/AddAndTrueToLoopCondition.h"
#include "compiler/translator/tree_ops/gl/mac/RegenerateStructNames.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteDoWhile.h"
#include "compiler/translator/tree_ops/gl/mac/UnfoldShortCircuitAST.h"
#include "compiler/translator/tree_ops/vulkan/EarlyFragmentTestsOptimization.h"
#include "compiler/translator/tree_util/BuiltIn.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
#include "compiler/translator/tree_util/ReplaceShadowingVariables.h"
......@@ -679,9 +679,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
if (compileOptions & SH_REGENERATE_STRUCT_NAMES)
{
RegenerateStructNames gen(&mSymbolTable);
root->traverse(&gen);
if (!validateAST(root))
if (!RegenerateStructNames(this, root, &mSymbolTable))
{
return false;
}
......
......@@ -24,7 +24,7 @@
#include "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/UtilsHLSL.h"
#include "compiler/translator/blocklayout.h"
#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h"
#include "compiler/translator/tree_ops/d3d/RemoveSwitchFallThrough.h"
#include "compiler/translator/tree_util/FindSymbolNode.h"
#include "compiler/translator/tree_util/NodeSearch.h"
#include "compiler/translator/util.h"
......
......@@ -138,7 +138,7 @@ class TStructure : public TSymbol, public TFieldListCollection
// TODO(zmo): Find a way to get rid of the const_cast in function
// setName(). At the moment keep this function private so only
// friend class RegenerateStructNames may call it.
friend class RegenerateStructNames;
friend class RegenerateStructNamesTraverser;
void setName(const ImmutableString &name);
bool mAtGlobalScope;
......
......@@ -9,7 +9,7 @@
#include "angle_gl.h"
#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
#include "compiler/translator/OutputESSL.h"
#include "compiler/translator/tree_ops/RecordConstantPrecision.h"
#include "compiler/translator/tree_ops/gl/RecordConstantPrecision.h"
namespace sh
{
......
......@@ -11,9 +11,9 @@
#include "compiler/translator/ExtensionGLSL.h"
#include "compiler/translator/OutputGLSL.h"
#include "compiler/translator/VersionGLSL.h"
#include "compiler/translator/tree_ops/RewriteRowMajorMatrices.h"
#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h"
#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteRowMajorMatrices.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteUnaryMinusOperatorFloat.h"
namespace sh
{
......
......@@ -7,26 +7,24 @@
#include "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/OutputHLSL.h"
#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h"
#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h"
#include "compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h"
#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h"
#include "compiler/translator/tree_ops/PruneEmptyCases.h"
#include "compiler/translator/tree_ops/RecordUniformBlocksWithLargeArrayMember.h"
#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h"
#include "compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h"
#include "compiler/translator/tree_ops/RewriteElseBlocks.h"
#include "compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h"
#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h"
#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h"
#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h"
#include "compiler/translator/tree_ops/SeparateArrayInitialization.h"
#include "compiler/translator/tree_ops/SeparateDeclarations.h"
#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h"
#include "compiler/translator/tree_ops/SimplifyLoopConditions.h"
#include "compiler/translator/tree_ops/SplitSequenceOperator.h"
#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h"
#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h"
#include "compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.h"
#include "compiler/translator/tree_ops/d3d/ArrayReturnValueToOutParameter.h"
#include "compiler/translator/tree_ops/d3d/BreakVariableAliasingInInnerLoops.h"
#include "compiler/translator/tree_ops/d3d/ExpandIntegerPowExpressions.h"
#include "compiler/translator/tree_ops/d3d/RecordUniformBlocksWithLargeArrayMember.h"
#include "compiler/translator/tree_ops/d3d/RewriteAtomicFunctionExpressions.h"
#include "compiler/translator/tree_ops/d3d/RewriteElseBlocks.h"
#include "compiler/translator/tree_ops/d3d/RewriteExpressionsWithShaderStorageBlock.h"
#include "compiler/translator/tree_ops/d3d/RewriteUnaryMinusOperatorInt.h"
#include "compiler/translator/tree_ops/d3d/SeparateArrayConstructorStatements.h"
#include "compiler/translator/tree_ops/d3d/SeparateArrayInitialization.h"
#include "compiler/translator/tree_ops/d3d/SeparateExpressionsReturningArrays.h"
#include "compiler/translator/tree_ops/d3d/UnfoldShortCircuitToIf.h"
#include "compiler/translator/tree_ops/d3d/WrapSwitchStatementsInBlocks.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
namespace sh
......
......@@ -19,15 +19,18 @@
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/OutputVulkanGLSL.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/tree_ops/FlagSamplersWithTexelFetch.h"
#include "compiler/translator/tree_ops/NameEmbeddedUniformStructs.h"
#include "compiler/translator/tree_ops/RemoveAtomicCounterBuiltins.h"
#include "compiler/translator/tree_ops/RemoveInactiveInterfaceVariables.h"
#include "compiler/translator/tree_ops/RewriteAtomicCounters.h"
#include "compiler/translator/tree_ops/RewriteCubeMapSamplersAs2DArray.h"
#include "compiler/translator/tree_ops/RewriteDfdy.h"
#include "compiler/translator/tree_ops/RewriteInterpolateAtOffset.h"
#include "compiler/translator/tree_ops/RewriteStructSamplers.h"
#include "compiler/translator/tree_ops/vulkan/FlagSamplersWithTexelFetch.h"
#include "compiler/translator/tree_ops/vulkan/NameEmbeddedUniformStructs.h"
#include "compiler/translator/tree_ops/vulkan/RemoveAtomicCounterBuiltins.h"
#include "compiler/translator/tree_ops/vulkan/RemoveInactiveInterfaceVariables.h"
#include "compiler/translator/tree_ops/vulkan/RewriteAtomicCounters.h"
#include "compiler/translator/tree_ops/vulkan/RewriteCubeMapSamplersAs2DArray.h"
#include "compiler/translator/tree_ops/vulkan/RewriteDfdy.h"
#include "compiler/translator/tree_ops/vulkan/RewriteInterpolateAtOffset.h"
#include "compiler/translator/tree_ops/vulkan/RewriteStructSamplers.h"
#include "compiler/translator/tree_util/BuiltIn.h"
#include "compiler/translator/tree_util/DriverUniform.h"
#include "compiler/translator/tree_util/FindFunction.h"
......
//
// 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.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
#define COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include <set>
namespace sh
{
class RegenerateStructNames : public TIntermTraverser
{
public:
RegenerateStructNames(TSymbolTable *symbolTable)
: TIntermTraverser(true, false, false, symbolTable), mScopeDepth(0)
{}
protected:
void visitSymbol(TIntermSymbol *) override;
bool visitBlock(Visit, TIntermBlock *block) override;
private:
// Indicating the depth of the current scope.
// The global scope is 1.
int mScopeDepth;
// If a struct's declared globally, push its ID in this set.
std::set<int> mDeclaredGlobalStructs;
};
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
......@@ -7,7 +7,7 @@
// return.
//
#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h"
#include "compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/IntermNode.h"
......
......@@ -7,8 +7,8 @@
// return.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_ADDDEFAULTRETURNSTATEMENTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_ADDDEFAULTRETURNSTATEMENTS_H_
#include "common/angleutils.h"
......@@ -21,4 +21,4 @@ ANGLE_NO_DISCARD bool AddDefaultReturnStatements(TCompiler *compiler, TIntermBlo
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_ADDDEFAULTRETURNSTATEMENTS_H_
......@@ -6,7 +6,7 @@
// The ArrayReturnValueToOutParameter function changes return values of an array type to out
// parameters in function definitions, prototypes, and call sites.
#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h"
#include "compiler/translator/tree_ops/d3d/ArrayReturnValueToOutParameter.h"
#include <map>
......
......@@ -6,8 +6,8 @@
// The ArrayReturnValueToOutParameter function changes return values of an array type to out
// parameters in function definitions, prototypes and call sites.
#ifndef COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
#define COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_ARRAYRETURNVALUETOOUTPARAMETER_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_ARRAYRETURNVALUETOOUTPARAMETER_H_
#include "common/angleutils.h"
......@@ -24,4 +24,4 @@ ANGLE_NO_DISCARD bool ArrayReturnValueToOutParameter(TCompiler *compiler,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_ARRAYRETURNVALUETOOUTPARAMETER_H_
......@@ -8,7 +8,7 @@
// may record a variable as aliasing another. Sometimes the alias information gets garbled
// so we work around this issue by breaking the aliasing chain in inner loops.
#include "BreakVariableAliasingInInnerLoops.h"
#include "compiler/translator/tree_ops/d3d/BreakVariableAliasingInInnerLoops.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -8,8 +8,8 @@
// may record a variable as aliasing another. Sometimes the alias information gets garbled
// so we work around this issue by breaking the aliasing chain in inner loops.
#ifndef COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
#define COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_BREAKVARIABLEALIASINGININNERLOOPS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_BREAKVARIABLEALIASINGININNERLOOPS_H_
#include "common/angleutils.h"
......@@ -22,4 +22,4 @@ ANGLE_NO_DISCARD bool BreakVariableAliasingInInnerLoops(TCompiler *compiler, TIn
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_BREAKVARIABLEALIASINGININNERLOOPS_H_
......@@ -6,7 +6,7 @@
// Implementation of the integer pow expressions HLSL bug workaround.
// See header for more info.
#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h"
#include "compiler/translator/tree_ops/d3d/ExpandIntegerPowExpressions.h"
#include <cmath>
#include <cstdlib>
......
......@@ -13,8 +13,8 @@
// The workaround is to replace the pow with a series of multiplies.
// See http://anglebug.com/851
#ifndef COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
#define COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_EXPANDINTEGERPOWEXPRESSIONS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_EXPANDINTEGERPOWEXPRESSIONS_H_
#include "common/angleutils.h"
......@@ -31,4 +31,4 @@ ANGLE_NO_DISCARD bool ExpandIntegerPowExpressions(TCompiler *compiler,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_EXPANDINTEGERPOWEXPRESSIONS_H_
......@@ -10,7 +10,7 @@
// on Direct3D backend.
//
#include "compiler/translator/tree_ops/RecordUniformBlocksWithLargeArrayMember.h"
#include "compiler/translator/tree_ops/d3d/RecordUniformBlocksWithLargeArrayMember.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -10,8 +10,8 @@
// on Direct3D backend.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
#define COMPILER_TRANSLATOR_TREEOPS_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
#include "compiler/translator/IntermNode.h"
......@@ -25,4 +25,4 @@ ANGLE_NO_DISCARD bool RecordUniformBlocksWithLargeArrayMember(
std::set<std::string> &slowCompilingUniformBlockSet);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_RECORDUNIFORMBLOCKSWITHLARGEARRAYMEMBER_H_
......@@ -8,7 +8,7 @@
// by this function. It leaves duplicate nodes in the AST making replacements
// unreliable.
#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h"
#include "compiler/translator/tree_ops/d3d/RemoveSwitchFallThrough.h"
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -8,8 +8,8 @@
// by this function. It leaves duplicate nodes in the AST making replacements
// unreliable.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
#define COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_REMOVESWITCHFALLTHROUGH_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_REMOVESWITCHFALLTHROUGH_H_
namespace sh
{
......@@ -24,4 +24,4 @@ TIntermBlock *RemoveSwitchFallThrough(TIntermBlock *statementList,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_REMOVESWITCHFALLTHROUGH_H_
......@@ -6,7 +6,7 @@
// Implementation of the function RewriteAtomicFunctionExpressions.
// See the header for more details.
#include "RewriteAtomicFunctionExpressions.h"
#include "compiler/translator/tree_ops/d3d/RewriteAtomicFunctionExpressions.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -22,8 +22,8 @@
// to ensure all the expressions that contain atomic function calls can be
// directly translated into HLSL expressions.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
#include "common/angleutils.h"
......@@ -39,4 +39,4 @@ ANGLE_NO_DISCARD bool RewriteAtomicFunctionExpressions(TCompiler *compiler,
int shaderVersion);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
......@@ -7,7 +7,7 @@
// all if-else blocks to if-if blocks.
//
#include "compiler/translator/tree_ops/RewriteElseBlocks.h"
#include "compiler/translator/tree_ops/d3d/RewriteElseBlocks.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/IntermNode.h"
......
......@@ -7,8 +7,8 @@
// all if-else blocks to if-if blocks.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEELSEBLOCKS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEELSEBLOCKS_H_
#include "common/angleutils.h"
......@@ -24,4 +24,4 @@ ANGLE_NO_DISCARD bool RewriteElseBlocks(TCompiler *compiler,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEELSEBLOCKS_H_
......@@ -11,7 +11,7 @@
// lvalue_no_ssbo = ssbo_access_chain;
//
#include "compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h"
#include "compiler/translator/tree_ops/d3d/RewriteExpressionsWithShaderStorageBlock.h"
#include "compiler/translator/Symbol.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -18,8 +18,8 @@
// SSBO as the argument of aggregate type.
// SSBO as the condition of if/switch/while/do-while/for
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
#include "common/angleutils.h"
......@@ -34,4 +34,4 @@ ANGLE_NO_DISCARD bool RewriteExpressionsWithShaderStorageBlock(TCompiler *compil
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
......@@ -6,7 +6,7 @@
// Implementation of evaluating unary integer variable bug workaround.
// See header for more info.
#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h"
#include "compiler/translator/tree_ops/d3d/RewriteUnaryMinusOperatorInt.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -6,8 +6,8 @@
// integer variable on Intel D3D driver. It works by rewriting -(int) to
// ~(int) + 1 when evaluating unary integer variables.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEUNARYMINUSOPERATORINT_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEUNARYMINUSOPERATORINT_H_
#include "common/angleutils.h"
......@@ -20,4 +20,4 @@ ANGLE_NO_DISCARD bool RewriteUnaryMinusOperatorInt(TCompiler *compiler, TIntermN
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_REWRITEUNARYMINUSOPERATORINT_H_
......@@ -9,7 +9,7 @@
// Will be changed to:
// i++;
#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h"
#include "compiler/translator/tree_ops/d3d/SeparateArrayConstructorStatements.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -9,8 +9,8 @@
// Will be changed to:
// i++;
#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
#include "common/angleutils.h"
......@@ -22,4 +22,4 @@ class TIntermBlock;
ANGLE_NO_DISCARD bool SeparateArrayConstructorStatements(TCompiler *compiler, TIntermBlock *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
......@@ -16,7 +16,7 @@
// stages don't care about const qualifiers. However, the initialization will not be split if the
// initializer can be written as a HLSL literal.
#include "compiler/translator/tree_ops/SeparateArrayInitialization.h"
#include "compiler/translator/tree_ops/d3d/SeparateArrayInitialization.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/OutputHLSL.h"
......
......@@ -16,8 +16,8 @@
// stages don't care about const qualifiers. However, the initialization will not be split if the
// initializer can be written as a HLSL literal.
#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYINITIALIZATION_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYINITIALIZATION_H_
#include "common/angleutils.h"
......@@ -29,4 +29,4 @@ class TIntermNode;
ANGLE_NO_DISCARD bool SeparateArrayInitialization(TCompiler *compiler, TIntermNode *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEARRAYINITIALIZATION_H_
......@@ -9,7 +9,7 @@
// (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2;
// type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i];
#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h"
#include "compiler/translator/tree_ops/d3d/SeparateExpressionsReturningArrays.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -9,8 +9,8 @@
// (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2;
// type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i];
#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
#include "common/angleutils.h"
......@@ -25,4 +25,4 @@ ANGLE_NO_DISCARD bool SeparateExpressionsReturningArrays(TCompiler *compiler,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
......@@ -9,7 +9,7 @@
// the original expression.
//
#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h"
#include "compiler/translator/tree_ops/d3d/UnfoldShortCircuitToIf.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
......
......@@ -9,8 +9,8 @@
// the original expression.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_UNFOLDSHORTCIRCUIT_H_
#include "common/angleutils.h"
......@@ -27,4 +27,4 @@ ANGLE_NO_DISCARD bool UnfoldShortCircuitToIf(TCompiler *compiler,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_UNFOLDSHORTCIRCUIT_H_
......@@ -26,7 +26,7 @@
// }
// }
#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h"
#include "compiler/translator/tree_ops/d3d/WrapSwitchStatementsInBlocks.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -6,8 +6,8 @@
// WrapSwitchStatementsInBlocks.h: Wrap switch statements in blocks and declare all switch-scoped
// variables there to make the AST compatible with HLSL output.
#ifndef COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
#define COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_D3D_WRAPSWITCHSTATEMENTSINBLOCKS_H_
#define COMPILER_TRANSLATOR_TREEOPS_D3D_WRAPSWITCHSTATEMENTSINBLOCKS_H_
#include "common/angleutils.h"
......@@ -22,4 +22,4 @@ ANGLE_NO_DISCARD bool WrapSwitchStatementsInBlocks(TCompiler *compiler, TIntermB
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_D3D_WRAPSWITCHSTATEMENTSINBLOCKS_H_
......@@ -8,7 +8,7 @@
// statically accesses gl_FragDepth.
//
#include "compiler/translator/tree_ops/ClampFragDepth.h"
#include "compiler/translator/tree_ops/gl/ClampFragDepth.h"
#include "compiler/translator/ImmutableString.h"
#include "compiler/translator/SymbolTable.h"
......
......@@ -8,8 +8,8 @@
// statically accesses gl_FragDepth.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
#define COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_CLAMPFRAGDEPTH_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_CLAMPFRAGDEPTH_H_
#include "common/angleutils.h"
......@@ -20,10 +20,20 @@ class TCompiler;
class TIntermBlock;
class TSymbolTable;
#ifdef ANGLE_ENABLE_GLSL
ANGLE_NO_DISCARD bool ClampFragDepth(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool ClampFragDepth(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_CLAMPFRAGDEPTH_H_
......@@ -14,7 +14,7 @@
// in case that is required for correct precision propagation.
//
#include "compiler/translator/tree_ops/RecordConstantPrecision.h"
#include "compiler/translator/tree_ops/gl/RecordConstantPrecision.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -14,8 +14,8 @@
// in case that is required for correct precision propagation.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
#define COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_RECORDCONSTANTPRECISION_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_RECORDCONSTANTPRECISION_H_
#include "common/angleutils.h"
......@@ -30,4 +30,4 @@ ANGLE_NO_DISCARD bool RecordConstantPrecision(TCompiler *compiler,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_RECORDCONSTANTPRECISION_H_
......@@ -13,7 +13,7 @@
// Note that this doesn't handle some corner cases: expressions nested inside other expressions,
// inside loop headers, or inside if conditions.
#include "compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h"
#include "compiler/translator/tree_ops/gl/RewriteRepeatedAssignToSwizzled.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -13,8 +13,8 @@
// Note that this doesn't handle some corner cases: expressions nested inside other expressions,
// inside loop headers, or inside if conditions.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
#include "common/angleutils.h"
......@@ -24,8 +24,17 @@ namespace sh
class TCompiler;
class TIntermBlock;
#ifdef ANGLE_ENABLE_GLSL
ANGLE_NO_DISCARD bool RewriteRepeatedAssignToSwizzled(TCompiler *compiler, TIntermBlock *root);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool RewriteRepeatedAssignToSwizzled(TCompiler *compiler,
TIntermBlock *root)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
......@@ -8,7 +8,7 @@
// the beginning of main. This is to work around a Mac driver that treats unused standard/shared
// uniform blocks as inactive.
#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h"
#include "compiler/translator/tree_ops/gl/UseInterfaceBlockFields.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/IntermNode.h"
......
......@@ -8,8 +8,8 @@
// the beginning of main. This is to work around a Mac driver that treats unused standard/shared
// uniform blocks as inactive.
#ifndef COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
#define COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_USEINTERFACEBLOCKFIELDS_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_USEINTERFACEBLOCKFIELDS_H_
#include <GLSLANG/ShaderLang.h>
#include "common/angleutils.h"
......@@ -23,11 +23,22 @@ class TSymbolTable;
using InterfaceBlockList = std::vector<sh::InterfaceBlock>;
#ifdef ANGLE_ENABLE_GLSL
ANGLE_NO_DISCARD bool UseInterfaceBlockFields(TCompiler *compiler,
TIntermBlock *root,
const InterfaceBlockList &blocks,
const TSymbolTable &symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool UseInterfaceBlockFields(TCompiler *compiler,
TIntermBlock *root,
const InterfaceBlockList &blocks,
const TSymbolTable &symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_USEINTERFACEBLOCKFIELDS_H_
......@@ -9,7 +9,7 @@
// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
// driver version 387.92. It works around the most common occurrences of the bug.
#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
#include "compiler/translator/tree_ops/gl/VectorizeVectorScalarArithmetic.h"
#include <set>
......
......@@ -9,8 +9,8 @@
// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
// driver version 387.92. It works around the most common occurrences of the bug.
#ifndef COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_
#define COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_VECTORIZEVECTORSCALARARITHMETIC_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_VECTORIZEVECTORSCALARARITHMETIC_H_
#include "common/angleutils.h"
......@@ -21,10 +21,20 @@ class TCompiler;
class TIntermBlock;
class TSymbolTable;
#ifdef ANGLE_ENABLE_GLSL
ANGLE_NO_DISCARD bool VectorizeVectorScalarArithmetic(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool VectorizeVectorScalarArithmetic(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_VECTORIZEVECTORSCALARARITHMETIC_H_
......@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
#include "compiler/translator/tree_ops/AddAndTrueToLoopCondition.h"
#include "compiler/translator/tree_ops/gl/mac/AddAndTrueToLoopCondition.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -6,8 +6,8 @@
// Rewrite condition in for and while loops to work around driver bug on Intel Mac.
#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
#define COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_ADDANDTRUETOLOOPCONDITION_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_ADDANDTRUETOLOOPCONDITION_H_
#include "common/angleutils.h"
......@@ -16,8 +16,16 @@ namespace sh
class TCompiler;
class TIntermNode;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool AddAndTrueToLoopCondition(TCompiler *compiler, TIntermNode *root);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool AddAndTrueToLoopCondition(TCompiler *compiler, TIntermNode *root)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_ADDANDTRUETOLOOPCONDITION_H_
......@@ -4,10 +4,15 @@
// found in the LICENSE file.
//
#include "compiler/translator/tree_ops/RegenerateStructNames.h"
#include "compiler/translator/tree_ops/gl/mac/RegenerateStructNames.h"
#include "common/debug.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/ImmutableStringBuilder.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include <set>
namespace sh
{
......@@ -17,7 +22,27 @@ namespace
constexpr const ImmutableString kPrefix("_webgl_struct_");
} // anonymous namespace
void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
class RegenerateStructNamesTraverser : public TIntermTraverser
{
public:
RegenerateStructNamesTraverser(TSymbolTable *symbolTable)
: TIntermTraverser(true, false, false, symbolTable), mScopeDepth(0)
{}
protected:
void visitSymbol(TIntermSymbol *) override;
bool visitBlock(Visit, TIntermBlock *block) override;
private:
// Indicating the depth of the current scope.
// The global scope is 1.
int mScopeDepth;
// If a struct is declared globally, push its ID in this set.
std::set<int> mDeclaredGlobalStructs;
};
void RegenerateStructNamesTraverser::visitSymbol(TIntermSymbol *symbol)
{
ASSERT(symbol);
const TType &type = symbol->getType();
......@@ -72,7 +97,7 @@ void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
const_cast<TStructure *>(userType)->setName(tmp);
}
bool RegenerateStructNames::visitBlock(Visit, TIntermBlock *block)
bool RegenerateStructNamesTraverser::visitBlock(Visit, TIntermBlock *block)
{
++mScopeDepth;
TIntermSequence &sequence = *(block->getSequence());
......@@ -84,4 +109,11 @@ bool RegenerateStructNames::visitBlock(Visit, TIntermBlock *block)
return false;
}
bool RegenerateStructNames(TCompiler *compiler, TIntermBlock *root, TSymbolTable *symbolTable)
{
RegenerateStructNamesTraverser traverser(symbolTable);
root->traverse(&traverser);
return compiler->validateAST(root);
}
} // namespace sh
//
// 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.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REGENERATESTRUCTNAMES_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REGENERATESTRUCTNAMES_H_
#include "common/angleutils.h"
namespace sh
{
class TCompiler;
class TIntermBlock;
class TSymbolTable;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool RegenerateStructNames(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool RegenerateStructNames(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REGENERATESTRUCTNAMES_H_
......@@ -7,7 +7,7 @@
// RewriteDoWhile.cpp: rewrites do-while loops using another equivalent
// construct.
#include "compiler/translator/tree_ops/RewriteDoWhile.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteDoWhile.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/StaticType.h"
......
......@@ -7,8 +7,8 @@
// RewriteDoWhile.h: rewrite do-while loops as while loops to work around
// driver bugs
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEDOWHILE_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEDOWHILE_H_
#include "common/angleutils.h"
......@@ -19,10 +19,20 @@ class TCompiler;
class TIntermNode;
class TSymbolTable;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool RewriteDoWhile(TCompiler *compiler,
TIntermNode *root,
TSymbolTable *symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool RewriteDoWhile(TCompiler *compiler,
TIntermNode *root,
TSymbolTable *symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEDOWHILE_H_
......@@ -6,7 +6,7 @@
// RewriteRowMajorMatrices: Rewrite row-major matrices as column-major.
//
#include "compiler/translator/tree_ops/RewriteRowMajorMatrices.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteRowMajorMatrices.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/ImmutableStringBuilder.h"
......
......@@ -6,8 +6,8 @@
// RewriteRowMajorMatrices: Change row-major matrices to column-major in uniform and storage
// buffers.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEROWMAJORMATRICES_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEROWMAJORMATRICES_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEROWMAJORMATRICES_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEROWMAJORMATRICES_H_
#include "common/angleutils.h"
......@@ -17,9 +17,19 @@ class TCompiler;
class TIntermBlock;
class TSymbolTable;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool RewriteRowMajorMatrices(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool RewriteRowMajorMatrices(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEROWMAJORMATRICES_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEROWMAJORMATRICES_H_
......@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h"
#include "compiler/translator/tree_ops/gl/mac/RewriteUnaryMinusOperatorFloat.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -5,8 +5,8 @@
// Rewrite "-float" to "0.0 - float" to work around unary minus operator on float issue on Intel Mac
// OSX 10.11.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEUNARYMINUSOPERATORFLOAT_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEUNARYMINUSOPERATORFLOAT_H_
#include "common/angleutils.h"
......@@ -15,8 +15,17 @@ namespace sh
class TCompiler;
class TIntermNode;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool RewriteUnaryMinusOperatorFloat(TCompiler *compiler, TIntermNode *root);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool RewriteUnaryMinusOperatorFloat(TCompiler *compiler,
TIntermNode *root)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_REWRITEUNARYMINUSOPERATORFLOAT_H_
......@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h"
#include "compiler/translator/tree_ops/gl/mac/UnfoldShortCircuitAST.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
......
......@@ -7,8 +7,8 @@
// operations with ternary operations.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_GL_MAC_UNFOLDSHORTCIRCUITAST_H_
#define COMPILER_TRANSLATOR_TREEOPS_GL_MAC_UNFOLDSHORTCIRCUITAST_H_
#include "common/angleutils.h"
......@@ -18,8 +18,16 @@ namespace sh
class TCompiler;
class TIntermBlock;
#if defined(ANGLE_ENABLE_GLSL) && defined(ANGLE_PLATFORM_APPLE)
ANGLE_NO_DISCARD bool UnfoldShortCircuitAST(TCompiler *compiler, TIntermBlock *root);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool UnfoldShortCircuitAST(TCompiler *compiler, TIntermBlock *root)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_GL_MAC_UNFOLDSHORTCIRCUITAST_H_
......@@ -7,7 +7,7 @@
// test as an optimization is feasible.
//
#include "compiler/translator/tree_ops/EarlyFragmentTestsOptimization.h"
#include "compiler/translator/tree_ops/vulkan/EarlyFragmentTestsOptimization.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/Symbol.h"
......
......@@ -7,8 +7,8 @@
// tests as an optimization is feasible.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_EARLYFRAGMENTTESTSOPTIMIZATION_H_
#define COMPILER_TRANSLATOR_TREEOPS_EARLYFRAGMENTTESTSOPTIMIZATION_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_EARLYFRAGMENTTESTSOPTIMIZATION_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_EARLYFRAGMENTTESTSOPTIMIZATION_H_
#include "common/angleutils.h"
......@@ -17,7 +17,16 @@ namespace sh
class TCompiler;
class TIntermNode;
#ifdef ANGLE_ENABLE_VULKAN
ANGLE_NO_DISCARD bool CheckEarlyFragmentTestsFeasible(TCompiler *compiler, TIntermNode *root);
#else
ANGLE_NO_DISCARD ANGLE_INLINE bool CheckEarlyFragmentTestsFeasible(TCompiler *compiler,
TIntermNode *root)
{
UNREACHABLE();
return false;
}
#endif
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_EARLYFRAGMENTTESTSOPTIMIZATION_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_EARLYFRAGMENTTESTSOPTIMIZATION_H_
......@@ -7,7 +7,7 @@
// a sampler uniform, and flag that uniform as having been used with texelFetch
//
#include "compiler/translator/tree_ops/FlagSamplersWithTexelFetch.h"
#include "compiler/translator/tree_ops/vulkan/FlagSamplersWithTexelFetch.h"
#include "angle_gl.h"
#include "common/utilities.h"
......
......@@ -7,8 +7,8 @@
// sampler uniform, and flag that uniform as having been used with texelFetch
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_FLAGSAMPLERSWITHTEXELFETCH_H_
#define COMPILER_TRANSLATOR_TREEOPS_FLAGSAMPLERSWITHTEXELFETCH_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_FLAGSAMPLERSWITHTEXELFETCH_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_FLAGSAMPLERSWITHTEXELFETCH_H_
#include "GLSLANG/ShaderVars.h"
#include "common/angleutils.h"
......@@ -28,4 +28,4 @@ ANGLE_NO_DISCARD bool FlagSamplersForTexelFetch(TCompiler *compiler,
std::vector<sh::ShaderVariable> *uniforms);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_FLAGSAMPLERSWITHTEXELFETCH_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_FLAGSAMPLERSWITHTEXELFETCH_H_
......@@ -6,7 +6,7 @@
// NameEmbeddedUniformStructs: Gives nameless uniform struct internal names.
//
#include "compiler/translator/tree_ops/NameEmbeddedUniformStructs.h"
#include "compiler/translator/tree_ops/vulkan/NameEmbeddedUniformStructs.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -12,8 +12,8 @@
// uniform s1 uni;
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
#include "common/angleutils.h"
......@@ -28,4 +28,4 @@ ANGLE_NO_DISCARD bool NameEmbeddedStructUniforms(TCompiler *compiler,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
......@@ -6,7 +6,7 @@
// RemoveAtomicCounterBuiltins: Remove atomic counter builtins.
//
#include "compiler/translator/tree_ops/RemoveAtomicCounterBuiltins.h"
#include "compiler/translator/tree_ops/vulkan/RemoveAtomicCounterBuiltins.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -8,8 +8,8 @@
// atomic counters are actually in use. This pass removes the builtins and
// asserts no atomic counters are declared.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEATOMICCOUNTERBUILTINS_H_
#define COMPILER_TRANSLATOR_TREEOPS_REMOVEATOMICCOUNTERBUILTINS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEATOMICCOUNTERBUILTINS_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEATOMICCOUNTERBUILTINS_H_
#include "common/angleutils.h"
......@@ -21,4 +21,4 @@ class TIntermBlock;
ANGLE_NO_DISCARD bool RemoveAtomicCounterBuiltins(TCompiler *compiler, TIntermBlock *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEATOMICCOUNTERBUILTINS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEATOMICCOUNTERBUILTINS_H_
......@@ -7,7 +7,7 @@
// Drop shader interface variable declarations for those that are inactive.
//
#include "compiler/translator/tree_ops/RemoveInactiveInterfaceVariables.h"
#include "compiler/translator/tree_ops/vulkan/RemoveInactiveInterfaceVariables.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
......
......@@ -12,8 +12,8 @@
// instead of relying on what was gathered during CollectVariables.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEINACTIVEVARIABLES_H_
#define COMPILER_TRANSLATOR_TREEOPS_REMOVEINACTIVEVARIABLES_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEINACTIVEVARIABLES_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEINACTIVEVARIABLES_H_
#include "common/angleutils.h"
......@@ -37,4 +37,4 @@ ANGLE_NO_DISCARD bool RemoveInactiveInterfaceVariables(
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEINACTIVEVARIABLES_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REMOVEINACTIVEVARIABLES_H_
......@@ -6,7 +6,7 @@
// RewriteAtomicCounters: Emulate atomic counter buffers with storage buffers.
//
#include "compiler/translator/tree_ops/RewriteAtomicCounters.h"
#include "compiler/translator/tree_ops/vulkan/RewriteAtomicCounters.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/ImmutableStringBuilder.h"
......
......@@ -6,8 +6,8 @@
// RewriteAtomicCounters: Change atomic counter buffers to storage buffers, with atomic counter
// variables being offsets into the uint array of that storage buffer.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEATOMICCOUNTERS_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEATOMICCOUNTERS_H_
#include "common/angleutils.h"
......@@ -25,4 +25,4 @@ ANGLE_NO_DISCARD bool RewriteAtomicCounters(TCompiler *compiler,
const TIntermTyped *acbBufferOffsets);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEATOMICCOUNTERS_H_
......@@ -7,7 +7,7 @@
// map emulation.
//
#include "compiler/translator/tree_ops/RewriteCubeMapSamplersAs2DArray.h"
#include "compiler/translator/tree_ops/vulkan/RewriteCubeMapSamplersAs2DArray.h"
#include "compiler/translator/Compiler.h"
#include "compiler/translator/ImmutableStringBuilder.h"
......@@ -380,12 +380,12 @@ class RewriteCubeMapSamplersAs2DArrayTraverser : public TIntermTraverser
// table calculates uc, vc and ma as well as the cube map face.
//
// Major Axis Direction Target uc vc ma
// +x TEXTURE_CUBE_MAP_POSITIVE_X −z −y |x|
// −x TEXTURE_CUBE_MAP_NEGATIVE_X z −y |x|
// +x TEXTURE_CUBE_MAP_POSITIVE_X -z -y |x|
// -x TEXTURE_CUBE_MAP_NEGATIVE_X z -y |x|
// +y TEXTURE_CUBE_MAP_POSITIVE_Y x z |y|
// −y TEXTURE_CUBE_MAP_NEGATIVE_Y x −z |y|
// +z TEXTURE_CUBE_MAP_POSITIVE_Z x y |z|
// −z TEXTURE_CUBE_MAP_NEGATIVE_Z −x −y |z|
// -y TEXTURE_CUBE_MAP_NEGATIVE_Y x -z |y|
// +z TEXTURE_CUBE_MAP_POSITIVE_Z x -y |z|
// -z TEXTURE_CUBE_MAP_NEGATIVE_Z -x -y |z|
//
// "Major" is an indication of the axis with the largest value. The cube map face indicates
// the layer to sample from. The uv coordinates to sample from are calculated as,
......
......@@ -9,8 +9,8 @@
// and therefore only looks at samplerCube (i.e. not integer variants or cube arrays) and sampling
// functions that are defined in ES GLSL 1.0 (i.e. not the cube overload of texture()).
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
#include "common/angleutils.h"
......@@ -26,4 +26,4 @@ ANGLE_NO_DISCARD bool RewriteCubeMapSamplersAs2DArray(TCompiler *compiler,
bool isFragmentShader);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITECUBEMAPSAMPLERSAS2DARRAY_H_
......@@ -6,7 +6,7 @@
// Implementation of dFdy viewport transformation.
// See header for more info.
#include "compiler/translator/tree_ops/RewriteDfdy.h"
#include "compiler/translator/tree_ops/vulkan/RewriteDfdy.h"
#include "common/angleutils.h"
#include "compiler/translator/StaticType.h"
......
......@@ -10,8 +10,8 @@
//
// See http://anglebug.com/3487
#ifndef COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_
#define COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEFLIPDFDY_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEFLIPDFDY_H_
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
......@@ -40,4 +40,4 @@ ANGLE_NO_DISCARD bool RewriteDfdy(TCompiler *compiler,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEFLIPDFDY_H_
......@@ -6,7 +6,7 @@
// Implementation of InterpolateAtOffset viewport transformation.
// See header for more info.
#include "compiler/translator/tree_ops/RewriteDfdy.h"
#include "compiler/translator/tree_ops/vulkan/RewriteInterpolateAtOffset.h"
#include "common/angleutils.h"
#include "compiler/translator/StaticType.h"
......
......@@ -11,10 +11,11 @@
//
// See http://anglebug.com/3589
#ifndef COMPILER_TRANSLATOR_TREEOPS_FLIP_INTERPOLATEATOFFSET_H_
#define COMPILER_TRANSLATOR_TREEOPS_FLIP_INTERPOLATEATOFFSET_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEINTERPOLATEATOFFSET_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEINTERPOLATEATOFFSET_H_
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
namespace sh
{
......@@ -24,6 +25,8 @@ class TIntermNode;
class TIntermBinary;
class TIntermTyped;
class TSymbolTable;
class SpecConst;
class DriverUniform;
// If fragRotation = nullptr, no rotation will be applied.
ANGLE_NO_DISCARD bool RewriteInterpolateAtOffset(TCompiler *compiler,
......@@ -36,4 +39,4 @@ ANGLE_NO_DISCARD bool RewriteInterpolateAtOffset(TCompiler *compiler,
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_FLIP_INTERPOLATEATOFFSET_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITEINTERPOLATEATOFFSET_H_
......@@ -6,7 +6,7 @@
// RewriteStructSamplers: Extract structs from samplers.
//
#include "compiler/translator/tree_ops/RewriteStructSamplers.h"
#include "compiler/translator/tree_ops/vulkan/RewriteStructSamplers.h"
#include "compiler/translator/ImmutableStringBuilder.h"
#include "compiler/translator/StaticType.h"
......
......@@ -18,8 +18,8 @@
// uniform S uni;
// uniform sampler2D uni_i;
#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
#define COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
#ifndef COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITESTRUCTSAMPLERS_H_
#define COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITESTRUCTSAMPLERS_H_
#include "common/angleutils.h"
......@@ -39,4 +39,4 @@ ANGLE_NO_DISCARD bool RewriteStructSamplersOld(TCompiler *compier,
int *removedUniformsCountOut);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
#endif // COMPILER_TRANSLATOR_TREEOPS_VULKAN_REWRITESTRUCTSAMPLERS_H_
......@@ -6,7 +6,7 @@
// RewriteStructSamplers: Extract structs from samplers.
//
#include "compiler/translator/tree_ops/RewriteStructSamplers.h"
#include "compiler/translator/tree_ops/vulkan/RewriteStructSamplers.h"
#include "compiler/translator/ImmutableStringBuilder.h"
#include "compiler/translator/SymbolTable.h"
......
......@@ -119,6 +119,17 @@ angle_test("angle_system_info_test") {
angle_test("angle_unittests") {
sources = angle_unittests_sources + [ "angle_unittest_main.cpp" ]
if (angle_enable_essl) {
sources += angle_unittests_essl_sources
}
if (angle_enable_glsl) {
sources += angle_unittests_glsl_sources
if (is_mac || is_ios) {
sources += angle_unittests_glsl_mac_sources
}
}
if (angle_enable_hlsl) {
sources += angle_unittests_hlsl_sources
defines = [ "ANGLE_ENABLE_HLSL" ]
......
......@@ -92,11 +92,8 @@ angle_unittests_sources = [
"compiler_tests/PruneUnusedFunctions_test.cpp",
"compiler_tests/QualificationOrderESSL31_test.cpp",
"compiler_tests/QualificationOrder_test.cpp",
"compiler_tests/RecordConstantPrecision_test.cpp",
"compiler_tests/RegenerateStructNames_test.cpp",
"compiler_tests/RemovePow_test.cpp",
"compiler_tests/RemoveUnreferencedVariables_test.cpp",
"compiler_tests/RewriteDoWhile_test.cpp",
"compiler_tests/SamplerMultisample_test.cpp",
"compiler_tests/SamplerVideoWEBGL_test.cpp",
"compiler_tests/ScalarizeVecAndMatConstructorArgs_test.cpp",
......@@ -107,9 +104,7 @@ angle_unittests_sources = [
"compiler_tests/TextureFunction_test.cpp",
"compiler_tests/TypeTracking_test.cpp",
"compiler_tests/Type_test.cpp",
"compiler_tests/UnfoldShortCircuitAST_test.cpp",
"compiler_tests/VariablePacker_test.cpp",
"compiler_tests/VectorizeVectorScalarArithmetic_test.cpp",
"compiler_tests/WorkGroupSize_test.cpp",
"preprocessor_tests/MockDiagnostics.h",
"preprocessor_tests/MockDirectiveHandler.h",
......@@ -141,6 +136,18 @@ angle_unittests_sources = [
"test_utils/compiler_test.h",
]
angle_unittests_essl_sources =
[ "compiler_tests/RecordConstantPrecision_test.cpp" ]
angle_unittests_glsl_sources =
[ "compiler_tests/VectorizeVectorScalarArithmetic_test.cpp" ]
angle_unittests_glsl_mac_sources = [
"compiler_tests/RegenerateStructNames_test.cpp",
"compiler_tests/RewriteDoWhile_test.cpp",
"compiler_tests/UnfoldShortCircuitAST_test.cpp",
]
# TODO(jmadill): should probably call this windows sources
angle_unittests_hlsl_sources = [
"../tests/compiler_tests/HLSLOutput_test.cpp",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment