mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
Translator: Remove the "variables" option
Variable collection is invariably enabled by the front-end as well as other major users of ANGLE such as Firefox. All translator backends except GLSL force-enable variable collection either way. This change removes this compile option and enables variable collection unconditionally. The flag itself remains in ShCompileOptions until references to it are removed from Chromium. Bug: chromium:1447314 Change-Id: I4d3b30c1bfbd345c5ad269abc62c0a6a59de2f56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568524 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
committed by
Angle LUCI CQ
parent
3f97a29ec3
commit
02e7f96759
@@ -95,6 +95,8 @@ int main(int argc, char *argv[])
|
||||
ShBuiltInResources resources;
|
||||
GenerateResources(&resources);
|
||||
|
||||
bool printActiveVariables = false;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
for (; (argc >= 1) && (failCode == ESuccess); argc--, argv++)
|
||||
@@ -110,7 +112,7 @@ int main(int argc, char *argv[])
|
||||
compileOptions.objectCode = true;
|
||||
break;
|
||||
case 'u':
|
||||
compileOptions.variables = true;
|
||||
printActiveVariables = true;
|
||||
break;
|
||||
case 's':
|
||||
if (argv[0][2] == '=')
|
||||
@@ -195,7 +197,6 @@ int main(int argc, char *argv[])
|
||||
case 'v':
|
||||
output = SH_SPIRV_VULKAN_OUTPUT;
|
||||
compileOptions.initializeUninitializedLocals = true;
|
||||
compileOptions.variables = true;
|
||||
break;
|
||||
case 'h':
|
||||
if (argv[0][4] == '1' && argv[0][5] == '1')
|
||||
@@ -380,7 +381,7 @@ int main(int argc, char *argv[])
|
||||
LogMsg("END", "COMPILER", numCompiles, "OBJ CODE");
|
||||
printf("\n\n");
|
||||
}
|
||||
if (compiled && compileOptions.variables)
|
||||
if (compiled && printActiveVariables)
|
||||
{
|
||||
LogMsg("BEGIN", "COMPILER", numCompiles, "VARIABLES");
|
||||
PrintActiveVariables(compiler);
|
||||
|
||||
@@ -967,8 +967,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
||||
{
|
||||
if (compileOptions.emulateGLDrawID)
|
||||
{
|
||||
if (!EmulateGLDrawID(this, root, &mSymbolTable, &mUniforms,
|
||||
shouldCollectVariables(compileOptions)))
|
||||
if (!EmulateGLDrawID(this, root, &mSymbolTable, &mUniforms))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -982,7 +981,6 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
||||
if (compileOptions.emulateGLBaseVertexBaseInstance)
|
||||
{
|
||||
if (!EmulateGLBaseVertexBaseInstance(this, root, &mSymbolTable, &mUniforms,
|
||||
shouldCollectVariables(compileOptions),
|
||||
compileOptions.addBaseVertexToVertexID))
|
||||
{
|
||||
return false;
|
||||
@@ -1075,43 +1073,40 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldCollectVariables(compileOptions))
|
||||
ASSERT(!mVariablesCollected);
|
||||
CollectVariables(root, &mAttributes, &mOutputVariables, &mUniforms, &mInputVaryings,
|
||||
&mOutputVaryings, &mSharedVariables, &mUniformBlocks, &mShaderStorageBlocks,
|
||||
mResources.HashFunction, &mSymbolTable, mShaderType, mExtensionBehavior,
|
||||
mResources, mTessControlShaderOutputVertices);
|
||||
collectInterfaceBlocks();
|
||||
mVariablesCollected = true;
|
||||
if (compileOptions.useUnusedStandardSharedBlocks)
|
||||
{
|
||||
ASSERT(!mVariablesCollected);
|
||||
CollectVariables(root, &mAttributes, &mOutputVariables, &mUniforms, &mInputVaryings,
|
||||
&mOutputVaryings, &mSharedVariables, &mUniformBlocks,
|
||||
&mShaderStorageBlocks, mResources.HashFunction, &mSymbolTable, mShaderType,
|
||||
mExtensionBehavior, mResources, mTessControlShaderOutputVertices);
|
||||
collectInterfaceBlocks();
|
||||
mVariablesCollected = true;
|
||||
if (compileOptions.useUnusedStandardSharedBlocks)
|
||||
if (!useAllMembersInUnusedStandardAndSharedBlocks(root))
|
||||
{
|
||||
if (!useAllMembersInUnusedStandardAndSharedBlocks(root))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (compileOptions.enforcePackingRestrictions)
|
||||
}
|
||||
if (compileOptions.enforcePackingRestrictions)
|
||||
{
|
||||
int maxUniformVectors = GetMaxUniformVectorsForShaderType(mShaderType, mResources);
|
||||
// Returns true if, after applying the packing rules in the GLSL ES 1.00.17 spec
|
||||
// Appendix A, section 7, the shader does not use too many uniforms.
|
||||
if (!CheckVariablesInPackingLimits(maxUniformVectors, mUniforms))
|
||||
{
|
||||
int maxUniformVectors = GetMaxUniformVectorsForShaderType(mShaderType, mResources);
|
||||
// Returns true if, after applying the packing rules in the GLSL ES 1.00.17 spec
|
||||
// Appendix A, section 7, the shader does not use too many uniforms.
|
||||
if (!CheckVariablesInPackingLimits(maxUniformVectors, mUniforms))
|
||||
{
|
||||
mDiagnostics.globalError("too many uniforms");
|
||||
return false;
|
||||
}
|
||||
mDiagnostics.globalError("too many uniforms");
|
||||
return false;
|
||||
}
|
||||
bool needInitializeOutputVariables =
|
||||
compileOptions.initOutputVariables && mShaderType != GL_COMPUTE_SHADER;
|
||||
needInitializeOutputVariables |=
|
||||
compileOptions.initFragmentOutputVariables && mShaderType == GL_FRAGMENT_SHADER;
|
||||
if (needInitializeOutputVariables)
|
||||
}
|
||||
bool needInitializeOutputVariables =
|
||||
compileOptions.initOutputVariables && mShaderType != GL_COMPUTE_SHADER;
|
||||
needInitializeOutputVariables |=
|
||||
compileOptions.initFragmentOutputVariables && mShaderType == GL_FRAGMENT_SHADER;
|
||||
if (needInitializeOutputVariables)
|
||||
{
|
||||
if (!initializeOutputVariables(root))
|
||||
{
|
||||
if (!initializeOutputVariables(root))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1723,16 +1718,6 @@ bool TCompiler::limitExpressionComplexity(TIntermBlock *root)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCompiler::shouldCollectVariables(const ShCompileOptions &compileOptions)
|
||||
{
|
||||
return compileOptions.variables;
|
||||
}
|
||||
|
||||
bool TCompiler::wereVariablesCollected() const
|
||||
{
|
||||
return mVariablesCollected;
|
||||
}
|
||||
|
||||
bool TCompiler::initializeGLPosition(TIntermBlock *root)
|
||||
{
|
||||
sh::ShaderVariable var(GL_FLOAT_VEC4);
|
||||
|
||||
@@ -245,9 +245,7 @@ class TCompiler : public TShHandleBase
|
||||
const BuiltInFunctionEmulator &getBuiltInFunctionEmulator() const;
|
||||
|
||||
virtual bool shouldFlattenPragmaStdglInvariantAll() = 0;
|
||||
virtual bool shouldCollectVariables(const ShCompileOptions &compileOptions);
|
||||
|
||||
bool wereVariablesCollected() const;
|
||||
std::vector<sh::ShaderVariable> mAttributes;
|
||||
std::vector<sh::ShaderVariable> mOutputVariables;
|
||||
std::vector<sh::ShaderVariable> mUniforms;
|
||||
|
||||
@@ -101,23 +101,21 @@ bool TranslatorESSL::translate(TIntermBlock *root,
|
||||
const TIntermSymbol *clipDistanceEnabledSymbol = new TIntermSymbol(clipDistanceEnabled);
|
||||
|
||||
// AngleInternal variables don't get collected
|
||||
if (shouldCollectVariables(compileOptions))
|
||||
{
|
||||
ShaderVariable uniform;
|
||||
uniform.name = kClipDistanceEnabledName.data();
|
||||
uniform.mappedName = kClipDistanceEnabledName.data();
|
||||
uniform.type = GLVariableType(*type);
|
||||
uniform.precision = GLVariablePrecision(*type);
|
||||
uniform.staticUse = true;
|
||||
uniform.active = true;
|
||||
uniform.binding = type->getLayoutQualifier().binding;
|
||||
uniform.location = type->getLayoutQualifier().location;
|
||||
uniform.offset = type->getLayoutQualifier().offset;
|
||||
uniform.rasterOrdered = type->getLayoutQualifier().rasterOrdered;
|
||||
uniform.readonly = type->getMemoryQualifier().readonly;
|
||||
uniform.writeonly = type->getMemoryQualifier().writeonly;
|
||||
mUniforms.push_back(uniform);
|
||||
}
|
||||
ShaderVariable uniform;
|
||||
uniform.name = kClipDistanceEnabledName.data();
|
||||
uniform.mappedName = kClipDistanceEnabledName.data();
|
||||
uniform.type = GLVariableType(*type);
|
||||
uniform.precision = GLVariablePrecision(*type);
|
||||
uniform.staticUse = true;
|
||||
uniform.active = true;
|
||||
uniform.binding = type->getLayoutQualifier().binding;
|
||||
uniform.location = type->getLayoutQualifier().location;
|
||||
uniform.offset = type->getLayoutQualifier().offset;
|
||||
uniform.rasterOrdered = type->getLayoutQualifier().rasterOrdered;
|
||||
uniform.readonly = type->getMemoryQualifier().readonly;
|
||||
uniform.writeonly = type->getMemoryQualifier().writeonly;
|
||||
mUniforms.push_back(uniform);
|
||||
|
||||
DeclareGlobalVariable(root, clipDistanceEnabled);
|
||||
if (!ZeroDisabledClipDistanceAssignments(this, root, &getSymbolTable(), getShaderType(),
|
||||
clipDistanceEnabledSymbol))
|
||||
|
||||
@@ -67,8 +67,6 @@ bool TranslatorGLSL::translate(TIntermBlock *root,
|
||||
if (compileOptions.flattenPragmaSTDGLInvariantAll && getPragma().stdgl.invariantAll &&
|
||||
!sh::RemoveInvariant(getShaderType(), getShaderVersion(), getOutputType(), compileOptions))
|
||||
{
|
||||
ASSERT(wereVariablesCollected());
|
||||
|
||||
switch (getShaderType())
|
||||
{
|
||||
case GL_VERTEX_SHADER:
|
||||
@@ -225,12 +223,6 @@ bool TranslatorGLSL::shouldFlattenPragmaStdglInvariantAll()
|
||||
return IsGLSL130OrNewer(getOutputType());
|
||||
}
|
||||
|
||||
bool TranslatorGLSL::shouldCollectVariables(const ShCompileOptions &compileOptions)
|
||||
{
|
||||
return compileOptions.flattenPragmaSTDGLInvariantAll ||
|
||||
TCompiler::shouldCollectVariables(compileOptions);
|
||||
}
|
||||
|
||||
void TranslatorGLSL::writeVersion(TIntermNode *root)
|
||||
{
|
||||
TVersionGLSL versionGLSL(getShaderType(), getPragma(), getOutputType());
|
||||
|
||||
@@ -25,7 +25,6 @@ class TranslatorGLSL : public TCompiler
|
||||
const ShCompileOptions &compileOptions,
|
||||
PerformanceDiagnostics *perfDiagnostics) override;
|
||||
bool shouldFlattenPragmaStdglInvariantAll() override;
|
||||
bool shouldCollectVariables(const ShCompileOptions &compileOptions) override;
|
||||
|
||||
private:
|
||||
void writeVersion(TIntermNode *root);
|
||||
|
||||
@@ -37,9 +37,6 @@ class TranslatorHLSL : public TCompiler
|
||||
PerformanceDiagnostics *perfDiagnostics) override;
|
||||
bool shouldFlattenPragmaStdglInvariantAll() override;
|
||||
|
||||
// collectVariables needs to be run always so registers can be assigned.
|
||||
bool shouldCollectVariables(const ShCompileOptions &compileOptions) override { return true; }
|
||||
|
||||
std::map<std::string, unsigned int> mShaderStorageBlockRegisterMap;
|
||||
std::map<std::string, unsigned int> mUniformBlockRegisterMap;
|
||||
std::map<std::string, bool> mUniformBlockUseStructuredBufferMap;
|
||||
|
||||
@@ -194,9 +194,6 @@ class TranslatorMetalDirect : public TCompiler
|
||||
// pixel local storage bans gl_SampleMask, so we can just not use it when PLS is active.
|
||||
bool isSampleMaskAllowed() const { return !hasPixelLocalStorageUniforms(); }
|
||||
|
||||
// Need to collect variables so that RemoveInactiveInterfaceVariables works.
|
||||
bool shouldCollectVariables(const ShCompileOptions &compileOptions) override { return true; }
|
||||
|
||||
[[nodiscard]] bool translateImpl(TInfoSinkBase &sink,
|
||||
TIntermBlock *root,
|
||||
const ShCompileOptions &compileOptions,
|
||||
|
||||
@@ -32,9 +32,6 @@ class TranslatorVulkan final : public TCompiler
|
||||
PerformanceDiagnostics *perfDiagnostics) override;
|
||||
bool shouldFlattenPragmaStdglInvariantAll() override;
|
||||
|
||||
// Need to collect variables so that RemoveInactiveInterfaceVariables works.
|
||||
bool shouldCollectVariables(const ShCompileOptions &compileOptions) override { return true; }
|
||||
|
||||
[[nodiscard]] bool translateImpl(TIntermBlock *root,
|
||||
const ShCompileOptions &compileOptions,
|
||||
PerformanceDiagnostics *perfDiagnostics,
|
||||
|
||||
@@ -120,8 +120,7 @@ class FindGLBaseInstanceTraverser : public TIntermTraverser
|
||||
bool EmulateGLDrawID(TCompiler *compiler,
|
||||
TIntermBlock *root,
|
||||
TSymbolTable *symbolTable,
|
||||
std::vector<sh::ShaderVariable> *uniforms,
|
||||
bool shouldCollect)
|
||||
std::vector<sh::ShaderVariable> *uniforms)
|
||||
{
|
||||
FindGLDrawIDTraverser traverser;
|
||||
root->traverse(&traverser);
|
||||
@@ -134,23 +133,20 @@ bool EmulateGLDrawID(TCompiler *compiler,
|
||||
const TIntermSymbol *drawIDSymbol = new TIntermSymbol(drawID);
|
||||
|
||||
// AngleInternal variables don't get collected
|
||||
if (shouldCollect)
|
||||
{
|
||||
ShaderVariable uniform;
|
||||
uniform.name = kEmulatedGLDrawIDName.data();
|
||||
uniform.mappedName = kEmulatedGLDrawIDName.data();
|
||||
uniform.type = GLVariableType(*type);
|
||||
uniform.precision = GLVariablePrecision(*type);
|
||||
uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
|
||||
uniform.active = true;
|
||||
uniform.binding = type->getLayoutQualifier().binding;
|
||||
uniform.location = type->getLayoutQualifier().location;
|
||||
uniform.offset = type->getLayoutQualifier().offset;
|
||||
uniform.rasterOrdered = type->getLayoutQualifier().rasterOrdered;
|
||||
uniform.readonly = type->getMemoryQualifier().readonly;
|
||||
uniform.writeonly = type->getMemoryQualifier().writeonly;
|
||||
uniforms->push_back(uniform);
|
||||
}
|
||||
ShaderVariable uniform;
|
||||
uniform.name = kEmulatedGLDrawIDName.data();
|
||||
uniform.mappedName = kEmulatedGLDrawIDName.data();
|
||||
uniform.type = GLVariableType(*type);
|
||||
uniform.precision = GLVariablePrecision(*type);
|
||||
uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
|
||||
uniform.active = true;
|
||||
uniform.binding = type->getLayoutQualifier().binding;
|
||||
uniform.location = type->getLayoutQualifier().location;
|
||||
uniform.offset = type->getLayoutQualifier().offset;
|
||||
uniform.rasterOrdered = type->getLayoutQualifier().rasterOrdered;
|
||||
uniform.readonly = type->getMemoryQualifier().readonly;
|
||||
uniform.writeonly = type->getMemoryQualifier().writeonly;
|
||||
uniforms->push_back(uniform);
|
||||
|
||||
DeclareGlobalVariable(root, drawID);
|
||||
if (!ReplaceVariableWithTyped(compiler, root, builtInVariable, drawIDSymbol))
|
||||
@@ -166,7 +162,6 @@ bool EmulateGLBaseVertexBaseInstance(TCompiler *compiler,
|
||||
TIntermBlock *root,
|
||||
TSymbolTable *symbolTable,
|
||||
std::vector<sh::ShaderVariable> *uniforms,
|
||||
bool shouldCollect,
|
||||
bool addBaseVertexToVertexID)
|
||||
{
|
||||
bool addBaseVertex = false, addBaseInstance = false;
|
||||
@@ -196,22 +191,19 @@ bool EmulateGLBaseVertexBaseInstance(TCompiler *compiler,
|
||||
const TIntermSymbol *baseVertexSymbol = new TIntermSymbol(baseVertex);
|
||||
|
||||
// AngleInternal variables don't get collected
|
||||
if (shouldCollect)
|
||||
{
|
||||
uniformBaseVertex.name = kEmulatedGLBaseVertexName.data();
|
||||
uniformBaseVertex.mappedName = kEmulatedGLBaseVertexName.data();
|
||||
uniformBaseVertex.type = GLVariableType(type);
|
||||
uniformBaseVertex.precision = GLVariablePrecision(type);
|
||||
uniformBaseVertex.staticUse = symbolTable->isStaticallyUsed(*builtInVariableBaseVertex);
|
||||
uniformBaseVertex.active = true;
|
||||
uniformBaseVertex.binding = type.getLayoutQualifier().binding;
|
||||
uniformBaseVertex.location = type.getLayoutQualifier().location;
|
||||
uniformBaseVertex.offset = type.getLayoutQualifier().offset;
|
||||
uniformBaseVertex.rasterOrdered = type.getLayoutQualifier().rasterOrdered;
|
||||
uniformBaseVertex.readonly = type.getMemoryQualifier().readonly;
|
||||
uniformBaseVertex.writeonly = type.getMemoryQualifier().writeonly;
|
||||
addBaseVertex = true;
|
||||
}
|
||||
uniformBaseVertex.name = kEmulatedGLBaseVertexName.data();
|
||||
uniformBaseVertex.mappedName = kEmulatedGLBaseVertexName.data();
|
||||
uniformBaseVertex.type = GLVariableType(type);
|
||||
uniformBaseVertex.precision = GLVariablePrecision(type);
|
||||
uniformBaseVertex.staticUse = symbolTable->isStaticallyUsed(*builtInVariableBaseVertex);
|
||||
uniformBaseVertex.active = true;
|
||||
uniformBaseVertex.binding = type.getLayoutQualifier().binding;
|
||||
uniformBaseVertex.location = type.getLayoutQualifier().location;
|
||||
uniformBaseVertex.offset = type.getLayoutQualifier().offset;
|
||||
uniformBaseVertex.rasterOrdered = type.getLayoutQualifier().rasterOrdered;
|
||||
uniformBaseVertex.readonly = type.getMemoryQualifier().readonly;
|
||||
uniformBaseVertex.writeonly = type.getMemoryQualifier().writeonly;
|
||||
addBaseVertex = true;
|
||||
|
||||
DeclareGlobalVariable(root, baseVertex);
|
||||
if (!ReplaceVariableWithTyped(compiler, root, builtInVariableBaseVertex, baseVertexSymbol))
|
||||
@@ -232,23 +224,19 @@ bool EmulateGLBaseVertexBaseInstance(TCompiler *compiler,
|
||||
const TIntermSymbol *baseInstanceSymbol = new TIntermSymbol(baseInstance);
|
||||
|
||||
// AngleInternal variables don't get collected
|
||||
if (shouldCollect)
|
||||
{
|
||||
uniformBaseInstance.name = kEmulatedGLBaseInstanceName.data();
|
||||
uniformBaseInstance.mappedName = kEmulatedGLBaseInstanceName.data();
|
||||
uniformBaseInstance.type = GLVariableType(type);
|
||||
uniformBaseInstance.precision = GLVariablePrecision(type);
|
||||
uniformBaseInstance.staticUse =
|
||||
symbolTable->isStaticallyUsed(*builtInVariableBaseInstance);
|
||||
uniformBaseInstance.active = true;
|
||||
uniformBaseInstance.binding = type.getLayoutQualifier().binding;
|
||||
uniformBaseInstance.location = type.getLayoutQualifier().location;
|
||||
uniformBaseInstance.offset = type.getLayoutQualifier().offset;
|
||||
uniformBaseInstance.rasterOrdered = type.getLayoutQualifier().rasterOrdered;
|
||||
uniformBaseInstance.readonly = type.getMemoryQualifier().readonly;
|
||||
uniformBaseInstance.writeonly = type.getMemoryQualifier().writeonly;
|
||||
addBaseInstance = true;
|
||||
}
|
||||
uniformBaseInstance.name = kEmulatedGLBaseInstanceName.data();
|
||||
uniformBaseInstance.mappedName = kEmulatedGLBaseInstanceName.data();
|
||||
uniformBaseInstance.type = GLVariableType(type);
|
||||
uniformBaseInstance.precision = GLVariablePrecision(type);
|
||||
uniformBaseInstance.staticUse = symbolTable->isStaticallyUsed(*builtInVariableBaseInstance);
|
||||
uniformBaseInstance.active = true;
|
||||
uniformBaseInstance.binding = type.getLayoutQualifier().binding;
|
||||
uniformBaseInstance.location = type.getLayoutQualifier().location;
|
||||
uniformBaseInstance.offset = type.getLayoutQualifier().offset;
|
||||
uniformBaseInstance.rasterOrdered = type.getLayoutQualifier().rasterOrdered;
|
||||
uniformBaseInstance.readonly = type.getMemoryQualifier().readonly;
|
||||
uniformBaseInstance.writeonly = type.getMemoryQualifier().writeonly;
|
||||
addBaseInstance = true;
|
||||
|
||||
DeclareGlobalVariable(root, baseInstance);
|
||||
if (!ReplaceVariableWithTyped(compiler, root, builtInVariableBaseInstance,
|
||||
|
||||
@@ -32,14 +32,12 @@ class TSymbolTable;
|
||||
[[nodiscard]] bool EmulateGLDrawID(TCompiler *compiler,
|
||||
TIntermBlock *root,
|
||||
TSymbolTable *symbolTable,
|
||||
std::vector<sh::ShaderVariable> *uniforms,
|
||||
bool shouldCollect);
|
||||
std::vector<sh::ShaderVariable> *uniforms);
|
||||
|
||||
[[nodiscard]] bool EmulateGLBaseVertexBaseInstance(TCompiler *compiler,
|
||||
TIntermBlock *root,
|
||||
TSymbolTable *symbolTable,
|
||||
std::vector<sh::ShaderVariable> *uniforms,
|
||||
bool shouldCollect,
|
||||
bool addBaseVertexToVertexID);
|
||||
|
||||
} // namespace sh
|
||||
|
||||
@@ -399,7 +399,6 @@ void Shader::compile(const Context *context)
|
||||
|
||||
ShCompileOptions options = {};
|
||||
options.objectCode = true;
|
||||
options.variables = true;
|
||||
options.emulateGLDrawID = true;
|
||||
|
||||
// Add default options to WebGL shaders to prevent unexpected behavior during
|
||||
|
||||
@@ -91,7 +91,6 @@ class APPLEClipDistanceTest : public sh::ShaderExtensionTest
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
|
||||
bool success = sh::Compile(mCompiler, shaderStrings, 3, compileOptions);
|
||||
if (success)
|
||||
|
||||
@@ -34,7 +34,6 @@ class AtomicCounterTest : public ShaderCompileTreeTest
|
||||
// and the values of offset are properly assigned to counter variables.
|
||||
TEST_F(AtomicCounterTest, BasicAtomicCounterDeclaration)
|
||||
{
|
||||
mCompileOptions.variables = true;
|
||||
const std::string &source =
|
||||
"#version 310 es\n"
|
||||
"layout(binding = 2, offset = 4) uniform atomic_uint a;\n"
|
||||
|
||||
@@ -58,7 +58,6 @@ class CollectVariablesTest : public testing::Test
|
||||
{
|
||||
const char *shaderStrings[] = {shaderString.c_str()};
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, compileOptions));
|
||||
|
||||
const std::vector<ShaderVariable> &uniforms = mTranslator->getUniforms();
|
||||
@@ -110,7 +109,6 @@ class CollectVariablesTest : public testing::Test
|
||||
{
|
||||
const char *shaderStrings[] = {shaderString.c_str()};
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, compileOptions))
|
||||
<< mTranslator->getInfoSink().info.str();
|
||||
|
||||
@@ -126,8 +124,6 @@ class CollectVariablesTest : public testing::Test
|
||||
|
||||
void compile(const std::string &shaderString, ShCompileOptions *compileOptions)
|
||||
{
|
||||
compileOptions->variables = true;
|
||||
|
||||
const char *shaderStrings[] = {shaderString.c_str()};
|
||||
ASSERT_TRUE(mTranslator->compile(shaderStrings, 1, *compileOptions));
|
||||
}
|
||||
|
||||
@@ -284,7 +284,6 @@ class EXTClipCullDistanceTest : public sh::ShaderExtensionTest
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
|
||||
const char *shaderStrings[] = {testing::get<1>(GetParam()), pragma,
|
||||
testing::get<2>(GetParam())};
|
||||
|
||||
@@ -185,7 +185,6 @@ class EXTShaderFramebufferFetchNoncoherentTest : public sh::ShaderExtensionTest
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
|
||||
const char *shaderStrings[] = {testing::get<1>(GetParam()), pragma,
|
||||
testing::get<2>(GetParam())};
|
||||
|
||||
@@ -22,7 +22,6 @@ class EmulateGLBaseVertexBaseInstanceTest : public MatchOutputCodeTest
|
||||
: MatchOutputCodeTest(GL_VERTEX_SHADER, SH_GLSL_COMPATIBILITY_OUTPUT)
|
||||
{
|
||||
ShCompileOptions defaultCompileOptions = {};
|
||||
defaultCompileOptions.variables = true;
|
||||
setDefaultCompileOptions(defaultCompileOptions);
|
||||
|
||||
getResources()->ANGLE_base_vertex_base_instance_shader_builtin = 1;
|
||||
@@ -38,7 +37,6 @@ class EmulateGLBaseVertexBaseInstanceTest : public MatchOutputCodeTest
|
||||
{
|
||||
options = *compileOptions;
|
||||
}
|
||||
options.variables = true;
|
||||
|
||||
std::string translatedCode;
|
||||
std::string infoLog;
|
||||
@@ -78,7 +76,6 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, CheckCompile)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLBaseVertexBaseInstance = true;
|
||||
|
||||
compile(shaderString, compileOptions);
|
||||
@@ -123,7 +120,6 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, EmulatesUniform)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLBaseVertexBaseInstance = true;
|
||||
|
||||
compile(shaderString, compileOptions);
|
||||
@@ -247,7 +243,6 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, AllowsUserDefinedANGLEDrawID)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLBaseVertexBaseInstance = true;
|
||||
|
||||
compile(shaderString, compileOptions);
|
||||
|
||||
@@ -21,7 +21,6 @@ class EmulateGLDrawIDTest : public MatchOutputCodeTest
|
||||
EmulateGLDrawIDTest() : MatchOutputCodeTest(GL_VERTEX_SHADER, SH_GLSL_COMPATIBILITY_OUTPUT)
|
||||
{
|
||||
ShCompileOptions defaultCompileOptions = {};
|
||||
defaultCompileOptions.variables = true;
|
||||
setDefaultCompileOptions(defaultCompileOptions);
|
||||
|
||||
getResources()->ANGLE_multi_draw = 1;
|
||||
@@ -31,7 +30,6 @@ class EmulateGLDrawIDTest : public MatchOutputCodeTest
|
||||
void CheckCompileFailure(const std::string &shaderString, const char *expectedError = nullptr)
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
|
||||
std::string translatedCode;
|
||||
std::string infoLog;
|
||||
@@ -69,7 +67,6 @@ TEST_F(EmulateGLDrawIDTest, CheckCompile)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLDrawID = true;
|
||||
|
||||
compile(shaderString, compileOptions);
|
||||
@@ -98,7 +95,6 @@ TEST_F(EmulateGLDrawIDTest, EmulatesUniform)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLDrawID = true;
|
||||
compile(shaderString, compileOptions);
|
||||
|
||||
@@ -174,7 +170,6 @@ TEST_F(EmulateGLDrawIDTest, AllowsUserDefinedANGLEDrawID)
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.emulateGLDrawID = true;
|
||||
compile(shaderString, compileOptions);
|
||||
|
||||
|
||||
@@ -191,7 +191,6 @@ class InitOutputVariablesWebGL2Test : public ShaderCompileTreeTest
|
||||
public:
|
||||
void SetUp() override
|
||||
{
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.initOutputVariables = true;
|
||||
if (getShaderType() == GL_VERTEX_SHADER)
|
||||
{
|
||||
@@ -224,11 +223,7 @@ class InitOutputVariablesWebGL2FragmentShaderTest : public InitOutputVariablesWe
|
||||
class InitOutputVariablesWebGL1FragmentShaderTest : public ShaderCompileTreeTest
|
||||
{
|
||||
public:
|
||||
InitOutputVariablesWebGL1FragmentShaderTest()
|
||||
{
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.initOutputVariables = true;
|
||||
}
|
||||
InitOutputVariablesWebGL1FragmentShaderTest() { mCompileOptions.initOutputVariables = true; }
|
||||
|
||||
protected:
|
||||
::GLenum getShaderType() const override { return GL_FRAGMENT_SHADER; }
|
||||
@@ -245,7 +240,6 @@ class InitOutputVariablesVertexShaderClipDistanceTest : public ShaderCompileTree
|
||||
public:
|
||||
InitOutputVariablesVertexShaderClipDistanceTest()
|
||||
{
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.initOutputVariables = true;
|
||||
mCompileOptions.validateAST = true;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ class KHRBlendEquationAdvancedTest : public sh::ShaderExtensionTest
|
||||
testing::get<2>(GetParam())};
|
||||
|
||||
ShCompileOptions compileFlags = {};
|
||||
compileFlags.variables = true;
|
||||
compileFlags.objectCode = true;
|
||||
if (emulate == Emulation::Enabled)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ class MSLVertexOutputTest : public MatchOutputCodeTest
|
||||
MSLVertexOutputTest() : MatchOutputCodeTest(GL_VERTEX_SHADER, SH_MSL_METAL_OUTPUT)
|
||||
{
|
||||
ShCompileOptions defaultCompileOptions = {};
|
||||
defaultCompileOptions.variables = true;
|
||||
setDefaultCompileOptions(defaultCompileOptions);
|
||||
}
|
||||
};
|
||||
@@ -32,7 +31,6 @@ class MSLOutputTest : public MatchOutputCodeTest
|
||||
MSLOutputTest() : MatchOutputCodeTest(GL_FRAGMENT_SHADER, SH_MSL_METAL_OUTPUT)
|
||||
{
|
||||
ShCompileOptions defaultCompileOptions = {};
|
||||
defaultCompileOptions.variables = true;
|
||||
setDefaultCompileOptions(defaultCompileOptions);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +79,6 @@ class OESSampleVariablesTest : public sh::ShaderExtensionTest
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
|
||||
bool success = sh::Compile(mCompiler, shaderStrings, 3, compileOptions);
|
||||
if (success)
|
||||
|
||||
@@ -81,7 +81,6 @@ class PreciseTest : public testing::TestWithParam<bool>
|
||||
const char *shaderStrings[] = {shaderSource};
|
||||
|
||||
ShCompileOptions options = {};
|
||||
options.variables = true;
|
||||
options.objectCode = true;
|
||||
|
||||
bool success = sh::Compile(mCompilerList[shaderOutputType], shaderStrings, 1, options);
|
||||
|
||||
@@ -26,7 +26,6 @@ class PruneUnusedFunctionsTest : public MatchOutputCodeTest
|
||||
void compile(const std::string &shaderString)
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
|
||||
MatchOutputCodeTest::compile(shaderString, compileOptions);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ class ShCompileTest : public testing::Test
|
||||
{
|
||||
ShCompileOptions options = {};
|
||||
options.objectCode = true;
|
||||
options.variables = true;
|
||||
options.initOutputVariables = true;
|
||||
|
||||
bool success = sh::Compile(mCompiler, shaderStrings, stringCount, options);
|
||||
|
||||
@@ -121,11 +121,7 @@ class ShaderImageTest : public ShaderCompileTreeTest
|
||||
ShaderImageTest() {}
|
||||
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
ShaderCompileTreeTest::SetUp();
|
||||
mCompileOptions.variables = true;
|
||||
}
|
||||
void SetUp() override { ShaderCompileTreeTest::SetUp(); }
|
||||
|
||||
::GLenum getShaderType() const override { return GL_COMPUTE_SHADER; }
|
||||
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
|
||||
|
||||
@@ -86,7 +86,6 @@ class ComputeShaderEnforcePackingValidationTest : public ComputeShaderValidation
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.enforcePackingRestrictions = true;
|
||||
ShaderCompileTreeTest::SetUp();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class ShaderVariableTest : public testing::Test
|
||||
public:
|
||||
ShaderVariableTest() : mVariablesCompileOptions{}, mObjectCodeCompileOptions{}
|
||||
{
|
||||
mVariablesCompileOptions.variables = true;
|
||||
mObjectCodeCompileOptions.objectCode = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ class UnrollFlattenTest : public testing::Test
|
||||
void compile(const std::string &shaderString)
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
|
||||
std::string infoLog;
|
||||
bool compilationSuccess =
|
||||
|
||||
@@ -36,7 +36,6 @@ class WorkGroupSizeTest : public testing::Test
|
||||
bool compile(const std::string &shaderString)
|
||||
{
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.variables = true;
|
||||
compileOptions.intermediateTree = true;
|
||||
|
||||
const char *shaderStrings[] = {shaderString.c_str()};
|
||||
|
||||
@@ -34,7 +34,6 @@ class ShaderBinaryTest : public ANGLETest<>
|
||||
ASSERT_EQ(sh::Initialize(), true);
|
||||
|
||||
mCompileOptions.objectCode = true;
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.emulateGLDrawID = true;
|
||||
mCompileOptions.initializeUninitializedLocals = true;
|
||||
|
||||
@@ -308,7 +307,6 @@ class ShaderBinaryTestES31 : public ShaderBinaryTest
|
||||
ASSERT_EQ(sh::Initialize(), true);
|
||||
|
||||
mCompileOptions.objectCode = true;
|
||||
mCompileOptions.variables = true;
|
||||
mCompileOptions.emulateGLDrawID = true;
|
||||
mCompileOptions.initializeUninitializedLocals = true;
|
||||
|
||||
|
||||
@@ -307,7 +307,6 @@ void CompilerPerfTest::step()
|
||||
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
compileOptions.initializeUninitializedLocals = true;
|
||||
compileOptions.initOutputVariables = true;
|
||||
|
||||
|
||||
@@ -155,13 +155,11 @@ bool ShaderCompileTreeTest::hasWarning() const
|
||||
|
||||
const std::vector<sh::ShaderVariable> &ShaderCompileTreeTest::getUniforms() const
|
||||
{
|
||||
ASSERT(mCompileOptions.variables);
|
||||
return mTranslator->getUniforms();
|
||||
}
|
||||
|
||||
const std::vector<sh::ShaderVariable> &ShaderCompileTreeTest::getAttributes() const
|
||||
{
|
||||
ASSERT(mCompileOptions.variables);
|
||||
return mTranslator->getAttributes();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ class ShaderExtensionTest
|
||||
const char *shaderStrings[] = {version, pragma, shader};
|
||||
ShCompileOptions compileOptions = {};
|
||||
compileOptions.objectCode = true;
|
||||
compileOptions.variables = true;
|
||||
bool success = sh::Compile(mCompiler, shaderStrings, 3, compileOptions);
|
||||
if (success)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user