<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[281794] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/281794">281794</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-08-31 01:11:32 -0700 (Tue, 31 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html fails
https://bugs.webkit.org/show_bug.cgi?id=223317
<rdar://problem/75772659>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-08-31
Reviewed by Kenneth Russell.

Source/ThirdParty/ANGLE:

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:

LayoutTests:

       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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkSourceThirdPartyANGLEANGLExcodeprojprojectpbxproj">trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceThirdPartyANGLEChangeLog">trunk/Source/ThirdParty/ANGLE/ChangeLog</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectDiscoverDependentFunctionscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectEmitMetalcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectEmitMetalh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewritePipelinescpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewritePipelinesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectSeparateCompoundExpressionscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewriteGlobalQualifierDeclscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewriteGlobalQualifierDeclsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/LayoutTests/ChangeLog 2021-08-31 08:11:32 UTC (rev 281794)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2021-08-31  Kimmo Kinnunen  <kkinnunen@apple.com>
+
+        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.
+
</ins><span class="cx"> 2021-08-31  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Cocoa] Drawing system fallback fonts to canvas causes a crash
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations       2021-08-31 07:40:52 UTC (rev 281793)
+++ trunk/LayoutTests/TestExpectations  2021-08-31 08:11:32 UTC (rev 281794)
</span><span class="lines">@@ -3667,7 +3667,9 @@
</span><span class="cx"> webgl/1.0.x/conformance/misc/invalid-passed-params.html [ Pass ]
</span><span class="cx"> webgl/1.0.x/conformance/glsl/bugs/character-set.html [ Pass ]
</span><span class="cx"> webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
</span><ins>+webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ]
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> # WebGL conformance test suite 2.0.1 is skipped until 2.0.0 is retired.
</span><span class="cx"> webgl/2.0.y [ Skip ]
</span><span class="cx"> 
</span><span class="lines">@@ -3676,6 +3678,7 @@
</span><span class="cx"> webgl/2.0.y/conformance/misc/invalid-passed-params.html [ Pass ]
</span><span class="cx"> webgl/2.0.y/conformance/glsl/bugs/character-set.html [ Pass ]
</span><span class="cx"> webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
</span><ins>+webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ]
</ins><span class="cx"> 
</span><span class="cx"> # WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation
</span><span class="cx"> # and tests for the new behavior. Should be removed once 1.0.3 and 2.0.0 are retired.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEANGLExcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -446,7 +446,6 @@
</span><span class="cx">          DF83E23C2639FCD5000825EF /* ReduceInterfaceBlocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF3D2581919700894E24 /* ReduceInterfaceBlocks.cpp */; };
</span><span class="cx">          DF83E23D2639FCD5000825EF /* DiscoverEnclosingFunctionTraverser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF412581919700894E24 /* DiscoverEnclosingFunctionTraverser.cpp */; };
</span><span class="cx">          DF83E23E2639FCD5000825EF /* IdGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF512581919700894E24 /* IdGen.cpp */; };
</span><del>-               DF83E23F2639FCD5000825EF /* RewriteGlobalQualifierDecls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */; };
</del><span class="cx">           DF83E2402639FCD5000825EF /* RewriteUnaddressableReferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF462581919700894E24 /* RewriteUnaddressableReferences.cpp */; };
</span><span class="cx">          DF83E2412639FCD5000825EF /* IntroduceVertexIndexID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF33284725F6CAB9005FDFC4 /* IntroduceVertexIndexID.cpp */; };
</span><span class="cx">          DF83E2422639FCD5000825EF /* ToposortStructs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF81FF332581919700894E24 /* ToposortStructs.cpp */; };
</span><span class="lines">@@ -1716,9 +1715,7 @@
</span><span class="cx">          FF81FF402581919700894E24 /* Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Layout.h; sourceTree = "<group>"; };
</span><span class="cx">          FF81FF412581919700894E24 /* DiscoverEnclosingFunctionTraverser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiscoverEnclosingFunctionTraverser.cpp; sourceTree = "<group>"; };
</span><span class="cx">          FF81FF422581919700894E24 /* ProgramPrelude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgramPrelude.h; sourceTree = "<group>"; };
</span><del>-               FF81FF432581919700894E24 /* RewriteGlobalQualifierDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RewriteGlobalQualifierDecls.h; sourceTree = "<group>"; };
</del><span class="cx">           FF81FF442581919700894E24 /* SymbolEnv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolEnv.h; sourceTree = "<group>"; };
</span><del>-               FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteGlobalQualifierDecls.cpp; sourceTree = "<group>"; };
</del><span class="cx">           FF81FF462581919700894E24 /* RewriteUnaddressableReferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteUnaddressableReferences.cpp; sourceTree = "<group>"; };
</span><span class="cx">          FF81FF472581919700894E24 /* AstHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AstHelpers.h; sourceTree = "<group>"; };
</span><span class="cx">          FF81FF482581919700894E24 /* HoistConstants.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HoistConstants.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -3051,8 +3048,6 @@
</span><span class="cx">                          FF81FF4B2581919700894E24 /* Reference.h */,
</span><span class="cx">                          FF81FF582581919700894E24 /* RewriteCaseDeclarations.cpp */,
</span><span class="cx">                          FF81FF592581919700894E24 /* RewriteCaseDeclarations.h */,
</span><del>-                               FF81FF452581919700894E24 /* RewriteGlobalQualifierDecls.cpp */,
-                               FF81FF432581919700894E24 /* RewriteGlobalQualifierDecls.h */,
</del><span class="cx">                           FF81FF4F2581919700894E24 /* RewriteKeywords.cpp */,
</span><span class="cx">                          FF81FF312581919700894E24 /* RewriteKeywords.h */,
</span><span class="cx">                          FF81FF362581919700894E24 /* RewriteOutArgs.cpp */,
</span><span class="lines">@@ -3846,7 +3841,6 @@
</span><span class="cx">                          DF83E2632639FD33000825EF /* RewriteDfdy.cpp in Sources */,
</span><span class="cx">                          DF83E2742639FD33000825EF /* RewriteDoWhile.cpp in Sources */,
</span><span class="cx">                          DF83E25C2639FD33000825EF /* RewriteExpressionsWithShaderStorageBlock.cpp in Sources */,
</span><del>-                               DF83E23F2639FCD5000825EF /* RewriteGlobalQualifierDecls.cpp in Sources */,
</del><span class="cx">                           DF83E27F2639FD33000825EF /* RewriteInterpolateAtOffset.cpp in Sources */,
</span><span class="cx">                          DF83E2452639FCD5000825EF /* RewriteKeywords.cpp in Sources */,
</span><span class="cx">                          DF83E2342639FCD5000825EF /* RewriteOutArgs.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,64 @@
</span><ins>+2021-08-31  Kimmo Kinnunen  <kkinnunen@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-08-25  Kimmo Kinnunen  <kkinnunen@apple.com>
</span><span class="cx"> 
</span><span class="cx">         ANGLE Metal index buffer restart range cache is could be maintained more consistently
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectDiscoverDependentFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -43,8 +43,10 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         const TFunction *owner = discoverEnclosingFunction(symbolNode);
</span><del>-        ASSERT(owner);
-        mDepFunctions.insert(owner);
</del><ins>+        if (owner)
+        {
+            mDepFunctions.insert(owner);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool visitAggregate(Visit visit, TIntermAggregate *aggregateNode) override
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectEmitMetalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -84,7 +84,6 @@
</span><span class="cx">                       Sink &out,
</span><span class="cx">                       IdGen &idGen,
</span><span class="cx">                       const PipelineStructs &pipelineStructs,
</span><del>-                      const Invariants &invariants,
</del><span class="cx">                       SymbolEnv &symbolEnv);
</span><span class="cx"> 
</span><span class="cx">     void visitSymbol(TIntermSymbol *) override;
</span><span class="lines">@@ -183,7 +182,6 @@
</span><span class="cx">     Sink &mOut;
</span><span class="cx">     const TCompiler &mCompiler;
</span><span class="cx">     const PipelineStructs &mPipelineStructs;
</span><del>-    const Invariants &mInvariants;
</del><span class="cx">     SymbolEnv &mSymbolEnv;
</span><span class="cx">     IdGen &mIdGen;
</span><span class="cx">     int mIndentLevel           = -1;
</span><span class="lines">@@ -212,13 +210,11 @@
</span><span class="cx">                                      Sink &out,
</span><span class="cx">                                      IdGen &idGen,
</span><span class="cx">                                      const PipelineStructs &pipelineStructs,
</span><del>-                                     const Invariants &invariants,
</del><span class="cx">                                      SymbolEnv &symbolEnv)
</span><span class="cx">     : TIntermTraverser(true, false, false),
</span><span class="cx">       mOut(out),
</span><span class="cx">       mCompiler(compiler),
</span><span class="cx">       mPipelineStructs(pipelineStructs),
</span><del>-      mInvariants(invariants),
</del><span class="cx">       mSymbolEnv(symbolEnv),
</span><span class="cx">       mIdGen(idGen)
</span><span class="cx"> {}
</span><span class="lines">@@ -937,9 +933,12 @@
</span><span class="cx">                                           const VarDecl &decl,
</span><span class="cx">                                           const TQualifier qualifier)
</span><span class="cx"> {
</span><ins>+    bool isInvariant = false;
</ins><span class="cx">     switch (qualifier)
</span><span class="cx">     {
</span><span class="cx">         case TQualifier::EvqPosition:
</span><ins>+            isInvariant = decl.type().isInvariant();
+            // Fallthrough.
</ins><span class="cx">         case TQualifier::EvqFragCoord:
</span><span class="cx">             mOut << " [[position]]";
</span><span class="cx">             break;
</span><span class="lines">@@ -973,9 +972,6 @@
</span><span class="cx">             break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const bool isInvariant =
-    (decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable())) && (qualifier == TQualifier::EvqPosition || qualifier == TQualifier::EvqFragCoord);
-
</del><span class="cx">     if (isInvariant)
</span><span class="cx">     {
</span><span class="cx">         mOut << " [[invariant]]";
</span><span class="lines">@@ -2378,7 +2374,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool GenMetalTraverser::visitGlobalQualifierDeclaration(Visit, TIntermGlobalQualifierDeclaration *)
</span><span class="cx"> {
</span><del>-    LOGIC_ERROR();  // RewriteGlobalQualifierDecls should have been called before this.
</del><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2604,7 +2599,6 @@
</span><span class="cx">                    TIntermBlock &root,
</span><span class="cx">                    IdGen &idGen,
</span><span class="cx">                    const PipelineStructs &pipelineStructs,
</span><del>-                   const Invariants &invariants,
</del><span class="cx">                    SymbolEnv &symbolEnv,
</span><span class="cx">                    const ProgramPreludeConfig &ppc)
</span><span class="cx"> {
</span><span class="lines">@@ -2663,7 +2657,7 @@
</span><span class="cx"> #else
</span><span class="cx">         TInfoSinkBase &outWrapper = out;
</span><span class="cx"> #endif
</span><del>-        GenMetalTraverser gen(compiler, outWrapper, idGen, pipelineStructs, invariants, symbolEnv);
</del><ins>+        GenMetalTraverser gen(compiler, outWrapper, idGen, pipelineStructs, symbolEnv);
</ins><span class="cx">         root.traverse(&gen);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectEmitMetalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.h (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -11,7 +11,6 @@
</span><span class="cx"> #include "compiler/translator/Compiler.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/IdGen.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/ProgramPrelude.h"
</span><del>-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
</del><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/RewritePipelines.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
</span><span class="cx"> 
</span><span class="lines">@@ -23,7 +22,6 @@
</span><span class="cx">                                 TIntermBlock &root,
</span><span class="cx">                                 IdGen &idGen,
</span><span class="cx">                                 const PipelineStructs &pipelineStructs,
</span><del>-                                const Invariants &invariants,
</del><span class="cx">                                 SymbolEnv &symbolEnv,
</span><span class="cx">                                 const ProgramPreludeConfig &ppc);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewriteGlobalQualifierDeclscpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,114 +0,0 @@
</span><del>-//
-// 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;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewriteGlobalQualifierDeclsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-//
-// 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_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewritePipelinescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,6 +27,20 @@
</span><span class="cx"> namespace
</span><span class="cx"> {
</span><span class="cx"> 
</span><ins>+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;
+}
+
</ins><span class="cx"> using VariableSet  = std::unordered_set<const TVariable *>;
</span><span class="cx"> using VariableList = std::vector<const TVariable *>;
</span><span class="cx"> 
</span><span class="lines">@@ -60,7 +74,7 @@
</span><span class="cx">   private:
</span><span class="cx">     const Pipeline &mPipeline;
</span><span class="cx">     SymbolEnv &mSymbolEnv;
</span><del>-    Invariants &mInvariants;
</del><ins>+    const std::vector<sh::ShaderVariable>* mVariableInfos;
</ins><span class="cx">     VariableList mPipelineVariableList;
</span><span class="cx">     IdGen &mIdGen;
</span><span class="cx">     PipelineStructInfo mInfo;
</span><span class="lines">@@ -72,9 +86,9 @@
</span><span class="cx">                      IdGen &idGen,
</span><span class="cx">                      const Pipeline &pipeline,
</span><span class="cx">                      SymbolEnv &symbolEnv,
</span><del>-                     Invariants &invariants)
</del><ins>+                     const std::vector<sh::ShaderVariable>* variableInfos)
</ins><span class="cx">     {
</span><del>-        GeneratePipelineStruct self(compiler, idGen, pipeline, symbolEnv, invariants);
</del><ins>+        GeneratePipelineStruct self(compiler, idGen, pipeline, symbolEnv, variableInfos);
</ins><span class="cx">         if (!self.exec(root))
</span><span class="cx">         {
</span><span class="cx">             return false;
</span><span class="lines">@@ -88,11 +102,11 @@
</span><span class="cx">                            IdGen &idGen,
</span><span class="cx">                            const Pipeline &pipeline,
</span><span class="cx">                            SymbolEnv &symbolEnv,
</span><del>-                           Invariants &invariants)
</del><ins>+                           const std::vector<sh::ShaderVariable>* variableInfos)
</ins><span class="cx">         : TIntermRebuild(compiler, true, true),
</span><span class="cx">           mPipeline(pipeline),
</span><span class="cx">           mSymbolEnv(symbolEnv),
</span><del>-          mInvariants(invariants),
</del><ins>+          mVariableInfos(variableInfos),
</ins><span class="cx">           mIdGen(idGen)
</span><span class="cx">     {}
</span><span class="cx"> 
</span><span class="lines">@@ -212,7 +226,6 @@
</span><span class="cx">             {
</span><span class="cx">                 for (const TVariable *var : mPipelineVariableList)
</span><span class="cx">                 {
</span><del>-                    ASSERT(!mInvariants.contains(*var));
</del><span class="cx">                     const TType &varType         = var->getType();
</span><span class="cx">                     const TBasicType samplerType = varType.getBasicType();
</span><span class="cx"> 
</span><span class="lines">@@ -247,13 +260,12 @@
</span><span class="cx">                 for (const TVariable *var : mPipelineVariableList)
</span><span class="cx">                 {
</span><span class="cx">                     auto &type  = CloneType(var->getType());
</span><ins>+                    if (mVariableInfos && IsVariableInvariant(*mVariableInfos, var->name()))
+                    {
+                        type.setInvariant(true);
+                    }
</ins><span class="cx">                     auto *field = new TField(&type, var->name(), kNoSourceLoc, var->symbolType());
</span><span class="cx">                     fields.push_back(field);
</span><del>-
-                    if (mInvariants.contains(*var))
-                    {
-                        mInvariants.insert(*field);
-                    }
</del><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="lines">@@ -848,12 +860,13 @@
</span><span class="cx">                            PipelineScoped<TVariable> pipelineMainLocalVar)
</span><span class="cx"> {
</span><span class="cx">     auto map = [&](const TFunction *owner, TIntermSymbol &symbol) -> TIntermNode & {
</span><ins>+        if (!owner)
+            return symbol;
</ins><span class="cx">         const TVariable &var = symbol.variable();
</span><span class="cx">         if (pipelineVariables.find(&var) == pipelineVariables.end())
</span><span class="cx">         {
</span><span class="cx">             return symbol;
</span><span class="cx">         }
</span><del>-        ASSERT(owner);
</del><span class="cx">         const TVariable *structInstanceVar;
</span><span class="cx">         if (owner->isMain())
</span><span class="cx">         {
</span><span class="lines">@@ -878,7 +891,7 @@
</span><span class="cx">                      IdGen &idGen,
</span><span class="cx">                      const Pipeline &pipeline,
</span><span class="cx">                      SymbolEnv &symbolEnv,
</span><del>-                     Invariants &invariants,
</del><ins>+                     const std::vector<sh::ShaderVariable>* variableInfo,
</ins><span class="cx">                      PipelineScoped<TStructure> &outStruct)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(outStruct.isTotallyEmpty());
</span><span class="lines">@@ -886,7 +899,7 @@
</span><span class="cx">     TSymbolTable &symbolTable = compiler.getSymbolTable();
</span><span class="cx"> 
</span><span class="cx">     PipelineStructInfo psi;
</span><del>-    if (!GeneratePipelineStruct::Exec(psi, compiler, root, idGen, pipeline, symbolEnv, invariants))
</del><ins>+    if (!GeneratePipelineStruct::Exec(psi, compiler, root, idGen, pipeline, symbolEnv, variableInfo))
</ins><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -932,10 +945,11 @@
</span><span class="cx"> 
</span><span class="cx"> bool sh::RewritePipelines(TCompiler &compiler,
</span><span class="cx">                           TIntermBlock &root,
</span><ins>+                          const std::vector<sh::ShaderVariable> &inputVaryings,
+                          const std::vector<sh::ShaderVariable> &outputVaryings,
</ins><span class="cx">                           IdGen &idGen,
</span><span class="cx">                           const TVariable &angleUniformsGlobalInstanceVar,
</span><span class="cx">                           SymbolEnv &symbolEnv,
</span><del>-                          Invariants &invariants,
</del><span class="cx">                           PipelineStructs &outStructs)
</span><span class="cx"> {
</span><span class="cx">     struct Info
</span><span class="lines">@@ -943,27 +957,28 @@
</span><span class="cx">         Pipeline::Type pipelineType;
</span><span class="cx">         PipelineScoped<TStructure> &outStruct;
</span><span class="cx">         const TVariable *globalInstanceVar;
</span><ins>+        const std::vector<sh::ShaderVariable> *variableInfo;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     Info infos[] = {
</span><del>-        {Pipeline::Type::InstanceId, outStructs.instanceId, nullptr},
-        {Pipeline::Type::Texture, outStructs.texture, nullptr},
</del><ins>+        {Pipeline::Type::InstanceId, outStructs.instanceId, nullptr, nullptr},
+        {Pipeline::Type::Texture, outStructs.texture, nullptr, nullptr},
</ins><span class="cx">         {Pipeline::Type::NonConstantGlobals, outStructs.nonConstantGlobals, nullptr},
</span><span class="cx">         {Pipeline::Type::AngleUniforms, outStructs.angleUniforms, &angleUniformsGlobalInstanceVar},
</span><del>-        {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},
</del><ins>+        {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},
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     for (Info &info : infos)
</span><span class="cx">     {
</span><span class="cx">         Pipeline pipeline{info.pipelineType, info.globalInstanceVar};
</span><del>-        if (!RewritePipeline(compiler, root, idGen, pipeline, symbolEnv, invariants,
</del><ins>+        if (!RewritePipeline(compiler, root, idGen, pipeline, symbolEnv, info.variableInfo,
</ins><span class="cx">                              info.outStruct))
</span><span class="cx">         {
</span><span class="cx">             return false;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectRewritePipelinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -11,7 +11,6 @@
</span><span class="cx"> #include "compiler/translator/Compiler.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/IdGen.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/Pipeline.h"
</span><del>-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
</del><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
</span><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="lines">@@ -34,10 +33,11 @@
</span><span class="cx"> //      from `main`.
</span><span class="cx"> ANGLE_NO_DISCARD bool RewritePipelines(TCompiler &compiler,
</span><span class="cx">                                        TIntermBlock &root,
</span><ins>+                                       const std::vector<sh::ShaderVariable> &inputVaryings,
+                                       const std::vector<sh::ShaderVariable> &outputVariables,
</ins><span class="cx">                                        IdGen &idGen,
</span><span class="cx">                                        const TVariable &angleUniformsGlobalInstanceVar,
</span><span class="cx">                                        SymbolEnv &symbolEnv,
</span><del>-                                       Invariants &invariants,
</del><span class="cx">                                        PipelineStructs &outStructs);
</span><span class="cx"> 
</span><span class="cx"> }  // namespace sh
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectSeparateCompoundExpressionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -619,7 +619,6 @@
</span><span class="cx"> 
</span><span class="cx">     PostResult visitGlobalQualifierDeclarationPost(TIntermGlobalQualifierDeclaration &node) override
</span><span class="cx">     {
</span><del>-        ASSERT(false);  // These should be scrubbed from AST before rewriter is called.
</del><span class="cx">         pushStmt(node);
</span><span class="cx">         return node;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorMetalDirectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp (281793 => 281794)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -20,7 +20,6 @@
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/Name.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/RewriteCaseDeclarations.h"
</span><del>-#include "compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
</del><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/RewriteKeywords.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/RewriteOutArgs.h"
</span><span class="cx"> #include "compiler/translator/TranslatorMetalDirect/RewritePipelines.h"
</span><span class="lines">@@ -1402,11 +1401,6 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Invariants invariants;
-    if (!RewriteGlobalQualifierDecls(*this, root, invariants))
-    {
-        return false;
-    }
</del><span class="cx">     const bool needsExplicitBoolCasts = (compileOptions & SH_ADD_EXPLICIT_BOOL_CASTS) != 0;
</span><span class="cx">     if (!AddExplicitTypeCasts(*this, root, symbolEnv, needsExplicitBoolCasts))
</span><span class="cx">     {
</span><span class="lines">@@ -1414,8 +1408,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     PipelineStructs pipelineStructs;
</span><del>-    if (!RewritePipelines(*this, root, idGen, driverUniforms, symbolEnv, invariants,
-                          pipelineStructs))
</del><ins>+    if (!RewritePipelines(*this, root, getInputVaryings(), getOutputVaryings(), idGen,
+                          driverUniforms, symbolEnv, pipelineStructs))
</ins><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -1453,7 +1447,7 @@
</span><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    if (!EmitMetal(*this, root, idGen, pipelineStructs, invariants, symbolEnv, ppc))
</del><ins>+    if (!EmitMetal(*this, root, idGen, pipelineStructs, symbolEnv, ppc))
</ins><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>