Diff
Modified: trunk/LayoutTests/ChangeLog (281793 => 281794)
--- trunk/LayoutTests/ChangeLog 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/LayoutTests/ChangeLog 2021-08-31 08:11:32 UTC (rev 281794)
@@ -1,3 +1,19 @@
+2021-08-31 Kimmo Kinnunen <[email protected]>
+
+ webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=223317
+ <rdar://problem/75772659>
+
+ Reviewed by Kenneth Russell.
+
+ Fixes tests:
+ webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html
+ webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html
+
+ * TestExpectations:
+ Mark the skipped tests as Pass until all 1.0.x/2.0.y tests
+ are unskipped.
+
2021-08-31 Myles C. Maxfield <[email protected]>
[Cocoa] Drawing system fallback fonts to canvas causes a crash
Modified: trunk/LayoutTests/TestExpectations (281793 => 281794)
--- trunk/LayoutTests/TestExpectations 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/LayoutTests/TestExpectations 2021-08-31 08:11:32 UTC (rev 281794)
@@ -3667,7 +3667,9 @@
webgl/1.0.x/conformance/misc/invalid-passed-params.html [ Pass ]
webgl/1.0.x/conformance/glsl/bugs/character-set.html [ Pass ]
webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
+webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ]
+
# WebGL conformance test suite 2.0.1 is skipped until 2.0.0 is retired.
webgl/2.0.y [ Skip ]
@@ -3676,6 +3678,7 @@
webgl/2.0.y/conformance/misc/invalid-passed-params.html [ Pass ]
webgl/2.0.y/conformance/glsl/bugs/character-set.html [ Pass ]
webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
+webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ]
# WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation
# and tests for the new behavior. Should be removed once 1.0.3 and 2.0.0 are retired.
Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj 2021-08-31 08:11:32 UTC (rev 281794)
@@ -446,7 +446,6 @@
DF83E23C2639FCD5000825EF /* ReduceInterfaceBlocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF3D2581919700894E24 /* ReduceInterfaceBlocks.cpp */; };
DF83E23D2639FCD5000825EF /* DiscoverEnclosingFunctionTraverser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF412581919700894E24 /* DiscoverEnclosingFunctionTraverser.cpp */; };
DF83E23E2639FCD5000825EF /* IdGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF512581919700894E24 /* IdGen.cpp */; };
- DF83E23F2639FCD5000825EF /* RewriteGlobalQualifierDecls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */; };
DF83E2402639FCD5000825EF /* RewriteUnaddressableReferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF462581919700894E24 /* RewriteUnaddressableReferences.cpp */; };
DF83E2412639FCD5000825EF /* IntroduceVertexIndexID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF33284725F6CAB9005FDFC4 /* IntroduceVertexIndexID.cpp */; };
DF83E2422639FCD5000825EF /* ToposortStructs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF332581919700894E24 /* ToposortStructs.cpp */; };
@@ -1716,9 +1715,7 @@
FF81FF402581919700894E24 /* Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Layout.h; sourceTree = "<group>"; };
FF81FF412581919700894E24 /* DiscoverEnclosingFunctionTraverser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiscoverEnclosingFunctionTraverser.cpp; sourceTree = "<group>"; };
FF81FF422581919700894E24 /* ProgramPrelude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgramPrelude.h; sourceTree = "<group>"; };
- FF81FF432581919700894E24 /* RewriteGlobalQualifierDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RewriteGlobalQualifierDecls.h; sourceTree = "<group>"; };
FF81FF442581919700894E24 /* SymbolEnv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolEnv.h; sourceTree = "<group>"; };
- FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteGlobalQualifierDecls.cpp; sourceTree = "<group>"; };
FF81FF462581919700894E24 /* RewriteUnaddressableReferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteUnaddressableReferences.cpp; sourceTree = "<group>"; };
FF81FF472581919700894E24 /* AstHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AstHelpers.h; sourceTree = "<group>"; };
FF81FF482581919700894E24 /* HoistConstants.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HoistConstants.cpp; sourceTree = "<group>"; };
@@ -3051,8 +3048,6 @@
FF81FF4B2581919700894E24 /* Reference.h */,
FF81FF582581919700894E24 /* RewriteCaseDeclarations.cpp */,
FF81FF592581919700894E24 /* RewriteCaseDeclarations.h */,
- FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */,
- FF81FF432581919700894E24 /* RewriteGlobalQualifierDecls.h */,
FF81FF4F2581919700894E24 /* RewriteKeywords.cpp */,
FF81FF312581919700894E24 /* RewriteKeywords.h */,
FF81FF362581919700894E24 /* RewriteOutArgs.cpp */,
@@ -3846,7 +3841,6 @@
DF83E2632639FD33000825EF /* RewriteDfdy.cpp in Sources */,
DF83E2742639FD33000825EF /* RewriteDoWhile.cpp in Sources */,
DF83E25C2639FD33000825EF /* RewriteExpressionsWithShaderStorageBlock.cpp in Sources */,
- DF83E23F2639FCD5000825EF /* RewriteGlobalQualifierDecls.cpp in Sources */,
DF83E27F2639FD33000825EF /* RewriteInterpolateAtOffset.cpp in Sources */,
DF83E2452639FCD5000825EF /* RewriteKeywords.cpp in Sources */,
DF83E2342639FCD5000825EF /* RewriteOutArgs.cpp in Sources */,
Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-08-31 08:11:32 UTC (rev 281794)
@@ -1,3 +1,64 @@
+2021-08-31 Kimmo Kinnunen <[email protected]>
+
+ webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=223317
+ <rdar://problem/75772659>
+
+ Reviewed by Kenneth Russell.
+
+ The parser maintains invariance metadata for each input and output
+ with the help of the symbol table, during parsing.
+
+ Use this metadata through the collection phase done by CollectVariables
+ section of shader compilation.
+
+ Remove the manual tree rewrite section that collected the invariance
+ information. The implementation had following problems:
+ 1) It would declare the variables present. This would fail the test case
+ fixed here, due to the test case using invariant declarations to both
+ FragColor and FragData, which would cause both to be present as outputs
+ to the MSL.
+ 2) It would operate on rewritten variables. For example, FragCoord would
+ be replaced with different variable, causing the invariance be marked
+ based on the rewritten name but the later lookup intended to be done
+ with the original name.
+
+ Remove logic to mark FragCoord as invariant, as MSL specification explicitly
+ says that only the vertex [[position]] output can be marked as [[invariant]].
+ As noted above, this never worked.
+
+ Fix cases where the tree rewriters assume that all variable references are
+ done within functions. The global qualifier declarations are now left
+ in the tree and as such can refer to variables but do not belong to any
+ function.
+
+ Fixes:
+ webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html
+ webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html
+
+ * ANGLE.xcodeproj/project.pbxproj:
+ * src/compiler/translator/TranslatorMetalDirect.cpp:
+ (sh::TranslatorMetalDirect::translateImpl):
+ * src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp:
+ * src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp:
+ (GenMetalTraverser::GenMetalTraverser):
+ (GenMetalTraverser::emitPostQualifier):
+ (GenMetalTraverser::visitGlobalQualifierDeclaration):
+ (sh::EmitMetal):
+ * src/compiler/translator/TranslatorMetalDirect/EmitMetal.h:
+ * src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp: Removed.
+ * src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h: Removed.
+ * src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp:
+ (sh::IsVariableInvariant):
+ (sh::GeneratePipelineStruct::Exec):
+ (sh::GeneratePipelineStruct::GeneratePipelineStruct):
+ (sh::GeneratePipelineStruct::createInternalPipelineStruct):
+ (sh::UpdatePipelineSymbols):
+ (sh::RewritePipeline):
+ (sh::RewritePipelines):
+ * src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h:
+ * src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp:
+
2021-08-25 Kimmo Kinnunen <[email protected]>
ANGLE Metal index buffer restart range cache is could be maintained more consistently
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -43,8 +43,10 @@
return;
}
const TFunction *owner = discoverEnclosingFunction(symbolNode);
- ASSERT(owner);
- mDepFunctions.insert(owner);
+ if (owner)
+ {
+ mDepFunctions.insert(owner);
+ }
}
bool visitAggregate(Visit visit, TIntermAggregate *aggregateNode) override
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -84,7 +84,6 @@
Sink &out,
IdGen &idGen,
const PipelineStructs &pipelineStructs,
- const Invariants &invariants,
SymbolEnv &symbolEnv);
void visitSymbol(TIntermSymbol *) override;
@@ -183,7 +182,6 @@
Sink &mOut;
const TCompiler &mCompiler;
const PipelineStructs &mPipelineStructs;
- const Invariants &mInvariants;
SymbolEnv &mSymbolEnv;
IdGen &mIdGen;
int mIndentLevel = -1;
@@ -212,13 +210,11 @@
Sink &out,
IdGen &idGen,
const PipelineStructs &pipelineStructs,
- const Invariants &invariants,
SymbolEnv &symbolEnv)
: TIntermTraverser(true, false, false),
mOut(out),
mCompiler(compiler),
mPipelineStructs(pipelineStructs),
- mInvariants(invariants),
mSymbolEnv(symbolEnv),
mIdGen(idGen)
{}
@@ -937,9 +933,12 @@
const VarDecl &decl,
const TQualifier qualifier)
{
+ bool isInvariant = false;
switch (qualifier)
{
case TQualifier::EvqPosition:
+ isInvariant = decl.type().isInvariant();
+ // Fallthrough.
case TQualifier::EvqFragCoord:
mOut << " [[position]]";
break;
@@ -973,9 +972,6 @@
break;
}
- const bool isInvariant =
- (decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable())) && (qualifier == TQualifier::EvqPosition || qualifier == TQualifier::EvqFragCoord);
-
if (isInvariant)
{
mOut << " [[invariant]]";
@@ -2378,7 +2374,6 @@
bool GenMetalTraverser::visitGlobalQualifierDeclaration(Visit, TIntermGlobalQualifierDeclaration *)
{
- LOGIC_ERROR(); // RewriteGlobalQualifierDecls should have been called before this.
return false;
}
@@ -2604,7 +2599,6 @@
TIntermBlock &root,
IdGen &idGen,
const PipelineStructs &pipelineStructs,
- const Invariants &invariants,
SymbolEnv &symbolEnv,
const ProgramPreludeConfig &ppc)
{
@@ -2663,7 +2657,7 @@
#else
TInfoSinkBase &outWrapper = out;
#endif
- GenMetalTraverser gen(compiler, outWrapper, idGen, pipelineStructs, invariants, symbolEnv);
+ GenMetalTraverser gen(compiler, outWrapper, idGen, pipelineStructs, symbolEnv);
root.traverse(&gen);
}
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.h (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.h 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.h 2021-08-31 08:11:32 UTC (rev 281794)
@@ -11,7 +11,6 @@
#include "compiler/translator/Compiler.h"
#include "compiler/translator/TranslatorMetalDirect/IdGen.h"
#include "compiler/translator/TranslatorMetalDirect/ProgramPrelude.h"
-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
#include "compiler/translator/TranslatorMetalDirect/RewritePipelines.h"
#include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
@@ -23,7 +22,6 @@
TIntermBlock &root,
IdGen &idGen,
const PipelineStructs &pipelineStructs,
- const Invariants &invariants,
SymbolEnv &symbolEnv,
const ProgramPreludeConfig &ppc);
Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -1,114 +0,0 @@
-//
-// Copyright 2020 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.
-//
-
-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
-#include "compiler/translator/TranslatorMetalDirect/Debug.h"
-#include "compiler/translator/tree_util/IntermRebuild.h"
-
-using namespace sh;
-
-namespace
-{
-
-class FindDeclaredGlobals : public TIntermRebuild
-{
- public:
- std::unordered_set<const TVariable *> mDeclaredGlobals;
-
- FindDeclaredGlobals(TCompiler &compiler) : TIntermRebuild(compiler, true, false) {}
-
- PreResult visitDeclarationPre(TIntermDeclaration &declNode) override
- {
- TIntermNode *declaratorNode = declNode.getChildNode(0);
- TIntermSymbol *symbolNode = nullptr;
-
- if (TIntermBinary *initNode = declaratorNode->getAsBinaryNode())
- {
- symbolNode = initNode->getLeft()->getAsSymbolNode();
- }
- else
- {
- symbolNode = declaratorNode->getAsSymbolNode();
- }
-
- ASSERT(symbolNode);
- const TVariable &var = symbolNode->variable();
-
- mDeclaredGlobals.insert(&var);
-
- return {declNode, VisitBits::Neither};
- }
-
- PreResult visitFunctionDefinitionPre(TIntermFunctionDefinition &node) override
- {
- return {node, VisitBits::Neither};
- }
-};
-
-class Rewriter : public TIntermRebuild
-{
- const std::unordered_set<const TVariable *> &mDeclaredGlobals;
- Invariants &mOutInvariants;
-
- public:
- Rewriter(TCompiler &compiler,
- const std::unordered_set<const TVariable *> &declaredGlobals,
- Invariants &outInvariants)
- : TIntermRebuild(compiler, true, false),
- mDeclaredGlobals(declaredGlobals),
- mOutInvariants(outInvariants)
- {}
-
- PreResult visitGlobalQualifierDeclarationPre(
- TIntermGlobalQualifierDeclaration &gqDeclNode) override
- {
- TIntermSymbol &symbolNode = *gqDeclNode.getSymbol();
- const TVariable &var = symbolNode.variable();
-
- if (gqDeclNode.isInvariant())
- {
- mOutInvariants.insert(var);
- }
-
- if (mDeclaredGlobals.find(&var) == mDeclaredGlobals.end())
- {
- return *new TIntermDeclaration{&symbolNode};
- }
- return nullptr;
- }
-
- PreResult visitDeclarationPre(TIntermDeclaration &node) override
- {
- return {node, VisitBits::Neither};
- }
-
- PreResult visitFunctionDefinitionPre(TIntermFunctionDefinition &node) override
- {
- return {node, VisitBits::Neither};
- }
-};
-
-} // anonymous namespace
-
-bool sh::RewriteGlobalQualifierDecls(TCompiler &compiler,
- TIntermBlock &root,
- Invariants &outInvariants)
-{
- FindDeclaredGlobals fdg(compiler);
- if (!fdg.rebuildRoot(root))
- {
- LOGIC_ERROR();
- return false;
- }
-
- Rewriter rewriter(compiler, fdg.mDeclaredGlobals, outInvariants);
- if (!rewriter.rebuildRoot(root))
- {
- return false;
- }
-
- return true;
-}
Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h 2021-08-31 08:11:32 UTC (rev 281794)
@@ -1,48 +0,0 @@
-//
-// Copyright 2020 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_TRANSLATORMETALDIRECT_REWRITEGLOBALQUALIFIERDECLS_H_
-#define COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITEGLOBALQUALIFIERDECLS_H_
-
-#include <unordered_set>
-
-#include "compiler/translator/Compiler.h"
-
-namespace sh
-{
-
-// Tracks TVariables and TFields that are marked as "invariant".
-class Invariants
-{
- public:
- void insert(const TVariable &var) { mInvariants.insert(&var); }
-
- void insert(const TField &field) { mInvariants.insert(&field); }
-
- bool contains(const TVariable &var) const
- {
- return mInvariants.find(&var) != mInvariants.end();
- }
-
- bool contains(const TField &field) const
- {
- return mInvariants.find(&field) != mInvariants.end();
- }
-
- private:
- std::unordered_set<const void *> mInvariants;
-};
-
-// This rewrites TIntermGlobalQualifierDeclarations as TIntermDeclarations.
-// `outInvariants` is populated with the information that would otherwise be lost by such a
-// transform.
-ANGLE_NO_DISCARD bool RewriteGlobalQualifierDecls(TCompiler &compiler,
- TIntermBlock &root,
- Invariants &outInvariants);
-
-} // namespace sh
-
-#endif // COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITEGLOBALQUALIFIERDECLS_H_
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -27,6 +27,20 @@
namespace
{
+bool IsVariableInvariant(const std::vector<sh::ShaderVariable> &mVars, const ImmutableString &name)
+{
+ for (const auto &var : mVars)
+ {
+ if (name == var.name)
+ {
+ return var.isInvariant;
+ }
+ }
+ // TODO: this should be UNREACHABLE() but isn't because the translator generates
+ // declarations to unused built-in variables.
+ return false;
+}
+
using VariableSet = std::unordered_set<const TVariable *>;
using VariableList = std::vector<const TVariable *>;
@@ -60,7 +74,7 @@
private:
const Pipeline &mPipeline;
SymbolEnv &mSymbolEnv;
- Invariants &mInvariants;
+ const std::vector<sh::ShaderVariable>* mVariableInfos;
VariableList mPipelineVariableList;
IdGen &mIdGen;
PipelineStructInfo mInfo;
@@ -72,9 +86,9 @@
IdGen &idGen,
const Pipeline &pipeline,
SymbolEnv &symbolEnv,
- Invariants &invariants)
+ const std::vector<sh::ShaderVariable>* variableInfos)
{
- GeneratePipelineStruct self(compiler, idGen, pipeline, symbolEnv, invariants);
+ GeneratePipelineStruct self(compiler, idGen, pipeline, symbolEnv, variableInfos);
if (!self.exec(root))
{
return false;
@@ -88,11 +102,11 @@
IdGen &idGen,
const Pipeline &pipeline,
SymbolEnv &symbolEnv,
- Invariants &invariants)
+ const std::vector<sh::ShaderVariable>* variableInfos)
: TIntermRebuild(compiler, true, true),
mPipeline(pipeline),
mSymbolEnv(symbolEnv),
- mInvariants(invariants),
+ mVariableInfos(variableInfos),
mIdGen(idGen)
{}
@@ -212,7 +226,6 @@
{
for (const TVariable *var : mPipelineVariableList)
{
- ASSERT(!mInvariants.contains(*var));
const TType &varType = var->getType();
const TBasicType samplerType = varType.getBasicType();
@@ -247,13 +260,12 @@
for (const TVariable *var : mPipelineVariableList)
{
auto &type = CloneType(var->getType());
+ if (mVariableInfos && IsVariableInvariant(*mVariableInfos, var->name()))
+ {
+ type.setInvariant(true);
+ }
auto *field = new TField(&type, var->name(), kNoSourceLoc, var->symbolType());
fields.push_back(field);
-
- if (mInvariants.contains(*var))
- {
- mInvariants.insert(*field);
- }
}
}
break;
@@ -848,12 +860,13 @@
PipelineScoped<TVariable> pipelineMainLocalVar)
{
auto map = [&](const TFunction *owner, TIntermSymbol &symbol) -> TIntermNode & {
+ if (!owner)
+ return symbol;
const TVariable &var = symbol.variable();
if (pipelineVariables.find(&var) == pipelineVariables.end())
{
return symbol;
}
- ASSERT(owner);
const TVariable *structInstanceVar;
if (owner->isMain())
{
@@ -878,7 +891,7 @@
IdGen &idGen,
const Pipeline &pipeline,
SymbolEnv &symbolEnv,
- Invariants &invariants,
+ const std::vector<sh::ShaderVariable>* variableInfo,
PipelineScoped<TStructure> &outStruct)
{
ASSERT(outStruct.isTotallyEmpty());
@@ -886,7 +899,7 @@
TSymbolTable &symbolTable = compiler.getSymbolTable();
PipelineStructInfo psi;
- if (!GeneratePipelineStruct::Exec(psi, compiler, root, idGen, pipeline, symbolEnv, invariants))
+ if (!GeneratePipelineStruct::Exec(psi, compiler, root, idGen, pipeline, symbolEnv, variableInfo))
{
return false;
}
@@ -932,10 +945,11 @@
bool sh::RewritePipelines(TCompiler &compiler,
TIntermBlock &root,
+ const std::vector<sh::ShaderVariable> &inputVaryings,
+ const std::vector<sh::ShaderVariable> &outputVaryings,
IdGen &idGen,
const TVariable &angleUniformsGlobalInstanceVar,
SymbolEnv &symbolEnv,
- Invariants &invariants,
PipelineStructs &outStructs)
{
struct Info
@@ -943,27 +957,28 @@
Pipeline::Type pipelineType;
PipelineScoped<TStructure> &outStruct;
const TVariable *globalInstanceVar;
+ const std::vector<sh::ShaderVariable> *variableInfo;
};
Info infos[] = {
- {Pipeline::Type::InstanceId, outStructs.instanceId, nullptr},
- {Pipeline::Type::Texture, outStructs.texture, nullptr},
+ {Pipeline::Type::InstanceId, outStructs.instanceId, nullptr, nullptr},
+ {Pipeline::Type::Texture, outStructs.texture, nullptr, nullptr},
{Pipeline::Type::NonConstantGlobals, outStructs.nonConstantGlobals, nullptr},
{Pipeline::Type::AngleUniforms, outStructs.angleUniforms, &angleUniformsGlobalInstanceVar},
- {Pipeline::Type::UserUniforms, outStructs.userUniforms, nullptr},
- {Pipeline::Type::VertexIn, outStructs.vertexIn, nullptr},
- {Pipeline::Type::VertexOut, outStructs.vertexOut, nullptr},
- {Pipeline::Type::FragmentIn, outStructs.fragmentIn, nullptr},
- {Pipeline::Type::FragmentOut, outStructs.fragmentOut, nullptr},
- {Pipeline::Type::InvocationVertexGlobals, outStructs.invocationVertexGlobals, nullptr},
- {Pipeline::Type::InvocationFragmentGlobals, outStructs.invocationFragmentGlobals, nullptr},
- {Pipeline::Type::UniformBuffer, outStructs.uniformBuffers, nullptr},
+ {Pipeline::Type::UserUniforms, outStructs.userUniforms, nullptr, nullptr},
+ {Pipeline::Type::VertexIn, outStructs.vertexIn, nullptr, &inputVaryings},
+ {Pipeline::Type::VertexOut, outStructs.vertexOut, nullptr, &outputVaryings},
+ {Pipeline::Type::FragmentIn, outStructs.fragmentIn, nullptr, &inputVaryings},
+ {Pipeline::Type::FragmentOut, outStructs.fragmentOut, nullptr, &outputVaryings},
+ {Pipeline::Type::InvocationVertexGlobals, outStructs.invocationVertexGlobals, nullptr, nullptr},
+ {Pipeline::Type::InvocationFragmentGlobals, outStructs.invocationFragmentGlobals, nullptr, &inputVaryings},
+ {Pipeline::Type::UniformBuffer, outStructs.uniformBuffers, nullptr, nullptr},
};
for (Info &info : infos)
{
Pipeline pipeline{info.pipelineType, info.globalInstanceVar};
- if (!RewritePipeline(compiler, root, idGen, pipeline, symbolEnv, invariants,
+ if (!RewritePipeline(compiler, root, idGen, pipeline, symbolEnv, info.variableInfo,
info.outStruct))
{
return false;
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h 2021-08-31 08:11:32 UTC (rev 281794)
@@ -11,7 +11,6 @@
#include "compiler/translator/Compiler.h"
#include "compiler/translator/TranslatorMetalDirect/IdGen.h"
#include "compiler/translator/TranslatorMetalDirect/Pipeline.h"
-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
#include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
namespace sh
@@ -34,10 +33,11 @@
// from `main`.
ANGLE_NO_DISCARD bool RewritePipelines(TCompiler &compiler,
TIntermBlock &root,
+ const std::vector<sh::ShaderVariable> &inputVaryings,
+ const std::vector<sh::ShaderVariable> &outputVariables,
IdGen &idGen,
const TVariable &angleUniformsGlobalInstanceVar,
SymbolEnv &symbolEnv,
- Invariants &invariants,
PipelineStructs &outStructs);
} // namespace sh
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -619,7 +619,6 @@
PostResult visitGlobalQualifierDeclarationPost(TIntermGlobalQualifierDeclaration &node) override
{
- ASSERT(false); // These should be scrubbed from AST before rewriter is called.
pushStmt(node);
return node;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp (281793 => 281794)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp 2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp 2021-08-31 08:11:32 UTC (rev 281794)
@@ -20,7 +20,6 @@
#include "compiler/translator/TranslatorMetalDirect/Name.h"
#include "compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h"
#include "compiler/translator/TranslatorMetalDirect/RewriteCaseDeclarations.h"
-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
#include "compiler/translator/TranslatorMetalDirect/RewriteKeywords.h"
#include "compiler/translator/TranslatorMetalDirect/RewriteOutArgs.h"
#include "compiler/translator/TranslatorMetalDirect/RewritePipelines.h"
@@ -1402,11 +1401,6 @@
return false;
}
- Invariants invariants;
- if (!RewriteGlobalQualifierDecls(*this, root, invariants))
- {
- return false;
- }
const bool needsExplicitBoolCasts = (compileOptions & SH_ADD_EXPLICIT_BOOL_CASTS) != 0;
if (!AddExplicitTypeCasts(*this, root, symbolEnv, needsExplicitBoolCasts))
{
@@ -1414,8 +1408,8 @@
}
PipelineStructs pipelineStructs;
- if (!RewritePipelines(*this, root, idGen, driverUniforms, symbolEnv, invariants,
- pipelineStructs))
+ if (!RewritePipelines(*this, root, getInputVaryings(), getOutputVaryings(), idGen,
+ driverUniforms, symbolEnv, pipelineStructs))
{
return false;
}
@@ -1453,7 +1447,7 @@
{
return false;
}
- if (!EmitMetal(*this, root, idGen, pipelineStructs, invariants, symbolEnv, ppc))
+ if (!EmitMetal(*this, root, idGen, pipelineStructs, symbolEnv, ppc))
{
return false;
}