Skip to content
Permalink
Browse files
Fix a number of functional regressions caused by enabling the Metal A…
…NGLE backend by default.

https://bugs.webkit.org/show_bug.cgi?id=220895
<rdar://problem/73539537>

Patch by Kyle Piddington <kpiddington@apple.com> on 2021-02-19
Reviewed by Kenneth Russell.

Fixed webgl/1.0.3/conformance/context/context-hidden-alpha.html

MTL Translator direct fixes for webgl/1.0.3/conformance/glsl/constructors/glsl-construct-*vec2 tests, Plus fix for GL_VertexIndex

Fix EmitMetal crash for missing function textureRect.

Additional fixes for 73675990, shaders-with-invariance.html, shaders-with-uniform-structs.html, struct-specifiers-in-uniforms.html, framebuffer-object-attachment.html

Fixed clamping of array elements.

* ANGLE.xcodeproj/project.pbxproj:
* src/compiler/translator/TranslatorMetalDirect.cpp:
(sh::TranslatorMetalDirect::translateImpl):
* src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp:
(GenMetalTraverser::emitPostQualifier):
(GenMetalTraverser::visitBinary):
(GenMetalTraverser::BuildFuncToName):
* src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.cpp: Added.
(sh::FixTypeTraverser::FixTypeTraverser):
(sh::FixTypeConstructors):
* src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h: Added.
* src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.cpp: Added.
(sh::NameEmbeddedStructUniformsMetal):
* src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h: Added.
* src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp:
(SaturateVectorOf):
* src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp:
(sh::ProgramPrelude::ProgramPrelude):
* src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp:
(sh::Reducer::Reducer):
(sh::ReduceInterfaceBlocks):
* src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h:
* src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:
* src/libANGLE/renderer/load_functions_table_autogen.cpp:
* src/libANGLE/renderer/metal/ContextMtl.mm:
(rx::ContextMtl::drawElementsImpl):
* src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.h:
* src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm:
(rx::IOSurfaceSurfaceMtl::IOSurfaceSurfaceMtl):
(rx::IOSurfaceSurfaceMtl::createBackingTexture):
* src/libANGLE/renderer/metal/RenderBufferMtl.mm:
(rx::RenderbufferMtl::setStorageImpl):
* src/libANGLE/renderer/metal/VertexArrayMtl.h:
* src/libANGLE/renderer/metal/VertexArrayMtl.mm:
(rx::VertexArrayMtl::getIndexBuffer):
(rx::VertexArrayMtl::convertIndexBuffer):
(rx::VertexArrayMtl::streamIndexBufferFromClient):
* src/libANGLE/renderer/metal/mtl_utils.mm:
(rx::mtl::InitializeDepthStencilTextureContentsGPU):
* src/libANGLE/renderer/metal/shaders/blit.metal:
* src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc:

Canonical link: https://commits.webkit.org/234374@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
kpiddington authored and grorg committed Feb 20, 2021
1 parent d3b0da5 commit ededf68a0e3ff5e6f64c2fc2608492383c971729
Showing 19 changed files with 329 additions and 77 deletions.
@@ -1180,6 +1180,9 @@
A3D3291523CFCB7700375657 /* RewriteRowMajorMatrices.h in Headers */ = {isa = PBXBuildFile; fileRef = A3D3290F23CFCB7600375657 /* RewriteRowMajorMatrices.h */; };
A3D3291823CFCB7700375657 /* RemoveInactiveInterfaceVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3D3291223CFCB7600375657 /* RemoveInactiveInterfaceVariables.cpp */; };
A3D3291923CFCB7700375657 /* RemoveInactiveInterfaceVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = A3D3291323CFCB7600375657 /* RemoveInactiveInterfaceVariables.h */; };
FF2D2F5425C8B14A002FB699 /* FixTypeConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */; };
FF2D2F5525C8B14A002FB699 /* FixTypeConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */; };
FF2D2F5625C8B14A002FB699 /* FixTypeConstructors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */; };
FF81FED025818D6800894E24 /* mtl_glslang_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */; };
FF81FED125818D6800894E24 /* ProgramMtl.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8125818D6800894E24 /* ProgramMtl.h */; };
FF81FED225818D6800894E24 /* DisplayMtl_api.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8225818D6800894E24 /* DisplayMtl_api.h */; };
@@ -1315,6 +1318,8 @@
FF81FFA22581AD0400894E24 /* clear.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB125818D6800894E24 /* clear.metal */; };
FF81FFA32581AD0400894E24 /* gen_mipmap.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB225818D6800894E24 /* gen_mipmap.metal */; };
FF81FFA42581AD0400894E24 /* gen_indices.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB325818D6800894E24 /* gen_indices.metal */; };
FFA0C2C725CB6A7700105306 /* NameEmbeddedUniformStructsMetal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */; };
FFA0C2C825CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h in Headers */ = {isa = PBXBuildFile; fileRef = FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */; };
/* End PBXBuildFile section */

/* Begin PBXBuildRule section */
@@ -2165,6 +2170,8 @@
A3D3291323CFCB7600375657 /* RemoveInactiveInterfaceVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveInactiveInterfaceVariables.h; sourceTree = "<group>"; };
FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; };
FB39D2BF1200F3E600088E69 /* ShaderLang.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ShaderLang.h; sourceTree = "<group>"; };
FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixTypeConstructors.h; sourceTree = "<group>"; };
FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FixTypeConstructors.cpp; sourceTree = "<group>"; };
FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mtl_glslang_utils.h; sourceTree = "<group>"; };
FF81FE8125818D6800894E24 /* ProgramMtl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgramMtl.h; sourceTree = "<group>"; };
FF81FE8225818D6800894E24 /* DisplayMtl_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayMtl_api.h; sourceTree = "<group>"; };
@@ -2302,6 +2309,8 @@
FF81FF982581A3C100894E24 /* AsNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsNode.h; sourceTree = "<group>"; };
FF81FF992581A3C100894E24 /* IntermRebuild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermRebuild.cpp; sourceTree = "<group>"; };
FF81FF9A2581A3C200894E24 /* IntermRebuild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntermRebuild.h; sourceTree = "<group>"; };
FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameEmbeddedUniformStructsMetal.cpp; sourceTree = "<group>"; };
FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameEmbeddedUniformStructsMetal.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -3573,6 +3582,8 @@
FF81FF2D2581919700894E24 /* EmitMetal.cpp */,
FF81FF522581919700894E24 /* EmitMetal.h */,
FF81FF282581919700894E24 /* EnvironmentVariable.h */,
FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */,
FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */,
FF81FF482581919700894E24 /* HoistConstants.cpp */,
FF81FF4C2581919700894E24 /* HoistConstants.h */,
FF81FF512581919700894E24 /* IdGen.cpp */,
@@ -3587,6 +3598,8 @@
FF81FF562581919700894E24 /* ModifyStruct.h */,
FF81FF212581919700894E24 /* Name.cpp */,
FF81FF242581919700894E24 /* Name.h */,
FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */,
FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */,
FF81FF372581919700894E24 /* Pipeline.cpp */,
FF81FF492581919700894E24 /* Pipeline.h */,
FF81FF502581919700894E24 /* ProgramPrelude.cpp */,
@@ -3737,6 +3750,7 @@
31CDFFAF249184A100486F27 /* FindMain.h in Headers */,
31CDFFB6249184A100486F27 /* FindSymbolNode.h in Headers */,
31CDFF682491848C00486F27 /* FixedVector.h in Headers */,
FF2D2F5525C8B14A002FB699 /* FixTypeConstructors.h in Headers */,
A3C49C16255DF866005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */,
31CDFFC0249184A700486F27 /* FlagStd140Structs.h in Headers */,
31CDFF7F2491849800486F27 /* FoldExpressions.h in Headers */,
@@ -4169,6 +4183,7 @@
5C55D6FF22826CB300B5BA2C /* FindMain.h in Headers */,
5C55D6FB22826CB300B5BA2C /* FindSymbolNode.h in Headers */,
5C55D7282282747700B5BA2C /* FixedVector.h in Headers */,
FF2D2F5425C8B14A002FB699 /* FixTypeConstructors.h in Headers */,
A3C49C12255DF865005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */,
5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */,
5C55D6A422826B9F00B5BA2C /* FoldExpressions.h in Headers */,
@@ -4274,6 +4289,7 @@
FF81FF0925818D6900894E24 /* mtl_utils.h in Headers */,
FF81FF5E2581919700894E24 /* Name.h in Headers */,
5C55D66922826B9F00B5BA2C /* NameEmbeddedUniformStructs.h in Headers */,
FFA0C2C825CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h in Headers */,
A303070B2305F6B5002DA972 /* no_destructor.h in Headers */,
5C55D70722826CB300B5BA2C /* NodeSearch.h in Headers */,
FF81FF9B2581A3C200894E24 /* NodeType.h in Headers */,
@@ -4746,6 +4762,7 @@
A30307032305F636002DA972 /* FindFunction.cpp in Sources */,
5C55D6FD22826CB300B5BA2C /* FindMain.cpp in Sources */,
5C55D70322826CB300B5BA2C /* FindSymbolNode.cpp in Sources */,
FF2D2F5625C8B14A002FB699 /* FixTypeConstructors.cpp in Sources */,
A3C49C0B255DF85F005E8DF7 /* FlagSamplersWithTexelFetch.cpp in Sources */,
5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */,
5CCD818F1DBFEA10006066B8 /* Float16ToFloat32.cpp in Sources */,
@@ -4828,6 +4845,7 @@
FF81FEEC25818D6900894E24 /* mtl_utils.mm in Sources */,
FF81FF5B2581919700894E24 /* Name.cpp in Sources */,
5C55D6B622826BC800B5BA2C /* NameEmbeddedUniformStructs.cpp in Sources */,
FFA0C2C725CB6A7700105306 /* NameEmbeddedUniformStructsMetal.cpp in Sources */,
315EBDBF1FCE44BF00AC7A89 /* null_functions.cpp in Sources */,
5CCD59692284F7960018F2D8 /* Observer.cpp in Sources */,
5C1DBC331B04375F00235552 /* Operator.cpp in Sources */,
@@ -1,3 +1,63 @@
2021-02-19 Kyle Piddington <kpiddington@apple.com>

Fix a number of functional regressions caused by enabling the Metal ANGLE backend by default.
https://bugs.webkit.org/show_bug.cgi?id=220895
<rdar://problem/73539537>

Reviewed by Kenneth Russell.

Fixed webgl/1.0.3/conformance/context/context-hidden-alpha.html

MTL Translator direct fixes for webgl/1.0.3/conformance/glsl/constructors/glsl-construct-*vec2 tests, Plus fix for GL_VertexIndex

Fix EmitMetal crash for missing function textureRect.

Additional fixes for 73675990, shaders-with-invariance.html, shaders-with-uniform-structs.html, struct-specifiers-in-uniforms.html, framebuffer-object-attachment.html

Fixed clamping of array elements.

* ANGLE.xcodeproj/project.pbxproj:
* src/compiler/translator/TranslatorMetalDirect.cpp:
(sh::TranslatorMetalDirect::translateImpl):
* src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp:
(GenMetalTraverser::emitPostQualifier):
(GenMetalTraverser::visitBinary):
(GenMetalTraverser::BuildFuncToName):
* src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.cpp: Added.
(sh::FixTypeTraverser::FixTypeTraverser):
(sh::FixTypeConstructors):
* src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h: Added.
* src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.cpp: Added.
(sh::NameEmbeddedStructUniformsMetal):
* src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h: Added.
* src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp:
(SaturateVectorOf):
* src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp:
(sh::ProgramPrelude::ProgramPrelude):
* src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp:
(sh::Reducer::Reducer):
(sh::ReduceInterfaceBlocks):
* src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h:
* src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:
* src/libANGLE/renderer/load_functions_table_autogen.cpp:
* src/libANGLE/renderer/metal/ContextMtl.mm:
(rx::ContextMtl::drawElementsImpl):
* src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.h:
* src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm:
(rx::IOSurfaceSurfaceMtl::IOSurfaceSurfaceMtl):
(rx::IOSurfaceSurfaceMtl::createBackingTexture):
* src/libANGLE/renderer/metal/RenderBufferMtl.mm:
(rx::RenderbufferMtl::setStorageImpl):
* src/libANGLE/renderer/metal/VertexArrayMtl.h:
* src/libANGLE/renderer/metal/VertexArrayMtl.mm:
(rx::VertexArrayMtl::getIndexBuffer):
(rx::VertexArrayMtl::convertIndexBuffer):
(rx::VertexArrayMtl::streamIndexBufferFromClient):
* src/libANGLE/renderer/metal/mtl_utils.mm:
(rx::mtl::InitializeDepthStencilTextureContentsGPU):
* src/libANGLE/renderer/metal/shaders/blit.metal:
* src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc:

2021-02-19 Kyle Piddington <kpiddington@apple.com>

Crash in readPixels with ANGLE Metal backend
@@ -27,12 +27,13 @@
#include "compiler/translator/TranslatorMetalDirect/RewriteUnaddressableReferences.h"
#include "compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.h"
#include "compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.h"
#include "compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h"
#include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
#include "compiler/translator/TranslatorMetalDirect/ToposortStructs.h"
#include "compiler/translator/TranslatorMetalDirect/WrapMain.h"
#include "compiler/translator/TranslatorMetalUtils.h"
#include "compiler/translator/tree_ops/InitializeVariables.h"
#include "compiler/translator/tree_ops/NameEmbeddedUniformStructs.h"
#include "compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h"
#include "compiler/translator/tree_ops/RemoveAtomicCounterBuiltins.h"
#include "compiler/translator/tree_ops/RemoveInactiveInterfaceVariables.h"
#include "compiler/translator/tree_ops/RewriteAtomicCounters.h"
@@ -602,6 +603,19 @@ void AddFragDepthDeclaration(TIntermBlock &root, TSymbolTable &symbolTable)
TIntermSequence{new TIntermDeclaration{BuiltInVariable::gl_FragDepth()}});
}

void AddFragDepthEXTDeclaration(TCompiler &compiler, TIntermBlock &root, TSymbolTable &symbolTable)
{
const TIntermSymbol *glFragDepthExt = FindSymbolNode(&root, ImmutableString("gl_FragDepthEXT"));
ASSERT(glFragDepthExt);

// Replace gl_FragData with our globally defined fragdata.
if (!ReplaceVariable(&compiler, &root, &(glFragDepthExt->variable()), BuiltInVariable::gl_FragDepth()))
{
return;
}
AddFragDepthDeclaration(root, symbolTable);
}

ANGLE_NO_DISCARD bool AddFragDataDeclaration(TCompiler &compiler, TIntermBlock &root)
{
TSymbolTable &symbolTable = compiler.getSymbolTable();
@@ -939,7 +953,7 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c

if (aggregateTypesUsedForUniforms > 0)
{
if (!NameEmbeddedStructUniforms(this, &root, &symbolTable))
if (!NameEmbeddedStructUniformsMetal(this, &root, &symbolTable))
{
return false;
}
@@ -1105,6 +1119,7 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
bool usesFragColor = false;
bool usesFragData = false;
bool usesFragDepth = false;
bool usesFragDepthEXT = false;
for (const ShaderVariable &outputVarying : mOutputVariables)
{
if (outputVarying.isBuiltIn())
@@ -1121,6 +1136,10 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
{
usesFragDepth = true;
}
else if (outputVarying.name == "gl_FragDepthEXT")
{
usesFragDepthEXT = true;
}
}
}

@@ -1141,8 +1160,11 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
return false;
}
}

if (usesFragDepth)
if(usesFragDepthEXT)
{
AddFragDepthEXTDeclaration(*this, root, symbolTable);
}
else if (usesFragDepth)
{
AddFragDepthDeclaration(root, symbolTable);
}
@@ -1220,6 +1242,15 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
}
DeclareRightBeforeMain(root, kgl_VertexIndexMetal);
}
else if (FindSymbolNode(&root, BuiltInVariable::gl_VertexID()->name()))
{
if (!ReplaceVariable(this, &root, BuiltInVariable::gl_VertexID(),
&kgl_VertexIndexMetal))
{
return false;
}
DeclareRightBeforeMain(root, kgl_VertexIndexMetal);
}

#if 0
if (compileOptions & SH_ADD_BRESENHAM_LINE_RASTER_EMULATION)
@@ -1319,7 +1350,7 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
return false;
}

if (!ReduceInterfaceBlocks(*this, root))
if (!ReduceInterfaceBlocks(*this, root, idGen))
{
return false;
}
@@ -1377,12 +1408,16 @@ bool TranslatorMetalDirect::translateImpl(TIntermBlock &root, ShCompileOptions c
{
return false;
}
if(!FixTypeConstructors(*this, symbolEnv, root))
{
return false;
}

if (!ToposortStructs(*this, symbolEnv, root, ppc))
{
return false;
}

if (!EmitMetal(*this, root, idGen, pipelineStructs, invariants, symbolEnv, ppc))
{
return false;
@@ -355,7 +355,8 @@ static const char *GetOperatorString(TOperator op,
case TOperator::EOpEqual:
if ((argType0->isVector() && argType1->isVector()) ||
(argType0->getStruct() && argType1->getStruct()) ||
(argType0->isArray() && argType1->isArray()))
(argType0->isArray() && argType1->isArray()) ||
(argType0->isMatrix() && argType1->isMatrix()))

{
return "ANGLE_equal";
@@ -365,7 +366,8 @@ static const char *GetOperatorString(TOperator op,

case TOperator::EOpNotEqual:
if ((argType0->isVector() && argType1->isVector()) ||
(argType0->isArray() && argType1->isArray()))
(argType0->isArray() && argType1->isArray())||
(argType0->isMatrix() && argType1->isMatrix()))
{
return "ANGLE_notEqual";
}
@@ -933,7 +935,7 @@ void GenMetalTraverser::emitPostQualifier(const EmitVariableDeclarationConfig &e
}

const bool isInvariant =
decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable());
(decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable())) && (qualifier == TQualifier::EvqPosition || qualifier == TQualifier::EvqFragCoord);

if (isInvariant)
{
@@ -1547,9 +1549,34 @@ bool GenMetalTraverser::visitBinary(Visit, TIntermBinary *binaryNode)
case TOperator::EOpIndexDirect:
case TOperator::EOpIndexIndirect:
{
TType leftType = leftNode.getType();
groupedTraverse(leftNode);
mOut << "[";
rightNode.traverse(this);
{
mOut << "ANGLE_int_clamp(";
groupedTraverse(rightNode);
mOut << ", 0, ";
if(leftType.isUnsizedArray())
{
groupedTraverse(leftNode);
mOut << ".size()";
}
else
{
int maxSize;
if (leftType.isArray())
{
maxSize = static_cast<int>(leftType.getOutermostArraySize()) - 1;
}
else
{
maxSize = leftType.getNominalSize() - 1;
}
mOut << maxSize;
}
mOut << ")";

}
mOut << "]";
}
break;
@@ -1868,7 +1895,9 @@ GenMetalTraverser::FuncToName GenMetalTraverser::BuildFuncToName()
putAngle("texture2D");
putAngle("texture2DLod");
putAngle("texture2DProj");
putAngle("texture2DRect");
putAngle("texture2DProjLod");
putAngle("texture2DRectProj");
putAngle("texture3D");
putAngle("texture3DLod");
putAngle("texture3DProjLod");
@@ -298,7 +298,8 @@ static int SaturateVectorOf(const TField &field)
ASSERT(type.isScalar() || type.isVector());

const bool cond = type.getBasicType() == BT && !type.isArray() &&
CompareBy(Cmp, type.getNominalSize(), MatchDim);
CompareBy(Cmp, type.getNominalSize(), MatchDim) && type.getQualifier() != TQualifier::EvqFragDepth;


if (cond)
{

0 comments on commit ededf68

Please sign in to comment.