Changeset 273188 in webkit
- Timestamp:
- Feb 19, 2021 6:09:07 PM (3 years ago)
- Location:
- trunk/Source/ThirdParty/ANGLE
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
r270733 r273188 1181 1181 A3D3291823CFCB7700375657 /* RemoveInactiveInterfaceVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3D3291223CFCB7600375657 /* RemoveInactiveInterfaceVariables.cpp */; }; 1182 1182 A3D3291923CFCB7700375657 /* RemoveInactiveInterfaceVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = A3D3291323CFCB7600375657 /* RemoveInactiveInterfaceVariables.h */; }; 1183 FF2D2F5425C8B14A002FB699 /* FixTypeConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */; }; 1184 FF2D2F5525C8B14A002FB699 /* FixTypeConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */; }; 1185 FF2D2F5625C8B14A002FB699 /* FixTypeConstructors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */; }; 1183 1186 FF81FED025818D6800894E24 /* mtl_glslang_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */; }; 1184 1187 FF81FED125818D6800894E24 /* ProgramMtl.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8125818D6800894E24 /* ProgramMtl.h */; }; … … 1316 1319 FF81FFA32581AD0400894E24 /* gen_mipmap.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB225818D6800894E24 /* gen_mipmap.metal */; }; 1317 1320 FF81FFA42581AD0400894E24 /* gen_indices.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB325818D6800894E24 /* gen_indices.metal */; }; 1321 FFA0C2C725CB6A7700105306 /* NameEmbeddedUniformStructsMetal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */; }; 1322 FFA0C2C825CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h in Headers */ = {isa = PBXBuildFile; fileRef = FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */; }; 1318 1323 /* End PBXBuildFile section */ 1319 1324 … … 2166 2171 FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; }; 2167 2172 FB39D2BF1200F3E600088E69 /* ShaderLang.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ShaderLang.h; sourceTree = "<group>"; }; 2173 FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixTypeConstructors.h; sourceTree = "<group>"; }; 2174 FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FixTypeConstructors.cpp; sourceTree = "<group>"; }; 2168 2175 FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mtl_glslang_utils.h; sourceTree = "<group>"; }; 2169 2176 FF81FE8125818D6800894E24 /* ProgramMtl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgramMtl.h; sourceTree = "<group>"; }; … … 2303 2310 FF81FF992581A3C100894E24 /* IntermRebuild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermRebuild.cpp; sourceTree = "<group>"; }; 2304 2311 FF81FF9A2581A3C200894E24 /* IntermRebuild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntermRebuild.h; sourceTree = "<group>"; }; 2312 FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameEmbeddedUniformStructsMetal.cpp; sourceTree = "<group>"; }; 2313 FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameEmbeddedUniformStructsMetal.h; sourceTree = "<group>"; }; 2305 2314 /* End PBXFileReference section */ 2306 2315 … … 3574 3583 FF81FF522581919700894E24 /* EmitMetal.h */, 3575 3584 FF81FF282581919700894E24 /* EnvironmentVariable.h */, 3585 FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */, 3586 FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */, 3576 3587 FF81FF482581919700894E24 /* HoistConstants.cpp */, 3577 3588 FF81FF4C2581919700894E24 /* HoistConstants.h */, … … 3588 3599 FF81FF212581919700894E24 /* Name.cpp */, 3589 3600 FF81FF242581919700894E24 /* Name.h */, 3601 FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */, 3602 FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */, 3590 3603 FF81FF372581919700894E24 /* Pipeline.cpp */, 3591 3604 FF81FF492581919700894E24 /* Pipeline.h */, … … 3738 3751 31CDFFB6249184A100486F27 /* FindSymbolNode.h in Headers */, 3739 3752 31CDFF682491848C00486F27 /* FixedVector.h in Headers */, 3753 FF2D2F5525C8B14A002FB699 /* FixTypeConstructors.h in Headers */, 3740 3754 A3C49C16255DF866005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */, 3741 3755 31CDFFC0249184A700486F27 /* FlagStd140Structs.h in Headers */, … … 4170 4184 5C55D6FB22826CB300B5BA2C /* FindSymbolNode.h in Headers */, 4171 4185 5C55D7282282747700B5BA2C /* FixedVector.h in Headers */, 4186 FF2D2F5425C8B14A002FB699 /* FixTypeConstructors.h in Headers */, 4172 4187 A3C49C12255DF865005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */, 4173 4188 5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */, … … 4275 4290 FF81FF5E2581919700894E24 /* Name.h in Headers */, 4276 4291 5C55D66922826B9F00B5BA2C /* NameEmbeddedUniformStructs.h in Headers */, 4292 FFA0C2C825CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h in Headers */, 4277 4293 A303070B2305F6B5002DA972 /* no_destructor.h in Headers */, 4278 4294 5C55D70722826CB300B5BA2C /* NodeSearch.h in Headers */, … … 4747 4763 5C55D6FD22826CB300B5BA2C /* FindMain.cpp in Sources */, 4748 4764 5C55D70322826CB300B5BA2C /* FindSymbolNode.cpp in Sources */, 4765 FF2D2F5625C8B14A002FB699 /* FixTypeConstructors.cpp in Sources */, 4749 4766 A3C49C0B255DF85F005E8DF7 /* FlagSamplersWithTexelFetch.cpp in Sources */, 4750 4767 5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */, … … 4829 4846 FF81FF5B2581919700894E24 /* Name.cpp in Sources */, 4830 4847 5C55D6B622826BC800B5BA2C /* NameEmbeddedUniformStructs.cpp in Sources */, 4848 FFA0C2C725CB6A7700105306 /* NameEmbeddedUniformStructsMetal.cpp in Sources */, 4831 4849 315EBDBF1FCE44BF00AC7A89 /* null_functions.cpp in Sources */, 4832 4850 5CCD59692284F7960018F2D8 /* Observer.cpp in Sources */, -
trunk/Source/ThirdParty/ANGLE/ChangeLog
r273137 r273188 1 2021-02-19 Kyle Piddington <kpiddington@apple.com> 2 3 Fix a number of functional regressions caused by enabling the Metal ANGLE backend by default. 4 https://bugs.webkit.org/show_bug.cgi?id=220895 5 <rdar://problem/73539537> 6 7 Reviewed by Kenneth Russell. 8 9 Fixed webgl/1.0.3/conformance/context/context-hidden-alpha.html 10 11 MTL Translator direct fixes for webgl/1.0.3/conformance/glsl/constructors/glsl-construct-*vec2 tests, Plus fix for GL_VertexIndex 12 13 Fix EmitMetal crash for missing function textureRect. 14 15 Additional fixes for 73675990, shaders-with-invariance.html, shaders-with-uniform-structs.html, struct-specifiers-in-uniforms.html, framebuffer-object-attachment.html 16 17 Fixed clamping of array elements. 18 19 * ANGLE.xcodeproj/project.pbxproj: 20 * src/compiler/translator/TranslatorMetalDirect.cpp: 21 (sh::TranslatorMetalDirect::translateImpl): 22 * src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp: 23 (GenMetalTraverser::emitPostQualifier): 24 (GenMetalTraverser::visitBinary): 25 (GenMetalTraverser::BuildFuncToName): 26 * src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.cpp: Added. 27 (sh::FixTypeTraverser::FixTypeTraverser): 28 (sh::FixTypeConstructors): 29 * src/compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h: Added. 30 * src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.cpp: Added. 31 (sh::NameEmbeddedStructUniformsMetal): 32 * src/compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h: Added. 33 * src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp: 34 (SaturateVectorOf): 35 * src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp: 36 (sh::ProgramPrelude::ProgramPrelude): 37 * src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp: 38 (sh::Reducer::Reducer): 39 (sh::ReduceInterfaceBlocks): 40 * src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h: 41 * src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp: 42 * src/libANGLE/renderer/load_functions_table_autogen.cpp: 43 * src/libANGLE/renderer/metal/ContextMtl.mm: 44 (rx::ContextMtl::drawElementsImpl): 45 * src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.h: 46 * src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm: 47 (rx::IOSurfaceSurfaceMtl::IOSurfaceSurfaceMtl): 48 (rx::IOSurfaceSurfaceMtl::createBackingTexture): 49 * src/libANGLE/renderer/metal/RenderBufferMtl.mm: 50 (rx::RenderbufferMtl::setStorageImpl): 51 * src/libANGLE/renderer/metal/VertexArrayMtl.h: 52 * src/libANGLE/renderer/metal/VertexArrayMtl.mm: 53 (rx::VertexArrayMtl::getIndexBuffer): 54 (rx::VertexArrayMtl::convertIndexBuffer): 55 (rx::VertexArrayMtl::streamIndexBufferFromClient): 56 * src/libANGLE/renderer/metal/mtl_utils.mm: 57 (rx::mtl::InitializeDepthStencilTextureContentsGPU): 58 * src/libANGLE/renderer/metal/shaders/blit.metal: 59 * src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc: 60 1 61 2021-02-19 Kyle Piddington <kpiddington@apple.com> 2 62 -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp
r270733 r273188 28 28 #include "compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.h" 29 29 #include "compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.h" 30 #include "compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h" 30 31 #include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h" 31 32 #include "compiler/translator/TranslatorMetalDirect/ToposortStructs.h" … … 33 34 #include "compiler/translator/TranslatorMetalUtils.h" 34 35 #include "compiler/translator/tree_ops/InitializeVariables.h" 35 #include "compiler/translator/ tree_ops/NameEmbeddedUniformStructs.h"36 #include "compiler/translator/TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h" 36 37 #include "compiler/translator/tree_ops/RemoveAtomicCounterBuiltins.h" 37 38 #include "compiler/translator/tree_ops/RemoveInactiveInterfaceVariables.h" … … 601 602 root.insertChildNodes(FindMainIndex(&root), 602 603 TIntermSequence{new TIntermDeclaration{BuiltInVariable::gl_FragDepth()}}); 604 } 605 606 void AddFragDepthEXTDeclaration(TCompiler &compiler, TIntermBlock &root, TSymbolTable &symbolTable) 607 { 608 const TIntermSymbol *glFragDepthExt = FindSymbolNode(&root, ImmutableString("gl_FragDepthEXT")); 609 ASSERT(glFragDepthExt); 610 611 // Replace gl_FragData with our globally defined fragdata. 612 if (!ReplaceVariable(&compiler, &root, &(glFragDepthExt->variable()), BuiltInVariable::gl_FragDepth())) 613 { 614 return; 615 } 616 AddFragDepthDeclaration(root, symbolTable); 603 617 } 604 618 … … 940 954 if (aggregateTypesUsedForUniforms > 0) 941 955 { 942 if (!NameEmbeddedStructUniforms (this, &root, &symbolTable))956 if (!NameEmbeddedStructUniformsMetal(this, &root, &symbolTable)) 943 957 { 944 958 return false; … … 1106 1120 bool usesFragData = false; 1107 1121 bool usesFragDepth = false; 1122 bool usesFragDepthEXT = false; 1108 1123 for (const ShaderVariable &outputVarying : mOutputVariables) 1109 1124 { … … 1122 1137 usesFragDepth = true; 1123 1138 } 1139 else if (outputVarying.name == "gl_FragDepthEXT") 1140 { 1141 usesFragDepthEXT = true; 1142 } 1124 1143 } 1125 1144 } … … 1142 1161 } 1143 1162 } 1144 1145 if (usesFragDepth) 1163 if(usesFragDepthEXT) 1164 { 1165 AddFragDepthEXTDeclaration(*this, root, symbolTable); 1166 } 1167 else if (usesFragDepth) 1146 1168 { 1147 1169 AddFragDepthDeclaration(root, symbolTable); … … 1221 1243 DeclareRightBeforeMain(root, kgl_VertexIndexMetal); 1222 1244 } 1245 else if (FindSymbolNode(&root, BuiltInVariable::gl_VertexID()->name())) 1246 { 1247 if (!ReplaceVariable(this, &root, BuiltInVariable::gl_VertexID(), 1248 &kgl_VertexIndexMetal)) 1249 { 1250 return false; 1251 } 1252 DeclareRightBeforeMain(root, kgl_VertexIndexMetal); 1253 } 1223 1254 1224 1255 #if 0 … … 1320 1351 } 1321 1352 1322 if (!ReduceInterfaceBlocks(*this, root ))1353 if (!ReduceInterfaceBlocks(*this, root, idGen)) 1323 1354 { 1324 1355 return false; … … 1378 1409 return false; 1379 1410 } 1411 if(!FixTypeConstructors(*this, symbolEnv, root)) 1412 { 1413 return false; 1414 } 1380 1415 1381 1416 if (!ToposortStructs(*this, symbolEnv, root, ppc)) … … 1383 1418 return false; 1384 1419 } 1385 1420 1386 1421 if (!EmitMetal(*this, root, idGen, pipelineStructs, invariants, symbolEnv, ppc)) 1387 1422 { -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp
r271334 r273188 356 356 if ((argType0->isVector() && argType1->isVector()) || 357 357 (argType0->getStruct() && argType1->getStruct()) || 358 (argType0->isArray() && argType1->isArray())) 358 (argType0->isArray() && argType1->isArray()) || 359 (argType0->isMatrix() && argType1->isMatrix())) 359 360 360 361 { … … 366 367 case TOperator::EOpNotEqual: 367 368 if ((argType0->isVector() && argType1->isVector()) || 368 (argType0->isArray() && argType1->isArray())) 369 (argType0->isArray() && argType1->isArray())|| 370 (argType0->isMatrix() && argType1->isMatrix())) 369 371 { 370 372 return "ANGLE_notEqual"; … … 934 936 935 937 const bool isInvariant = 936 decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable());938 (decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable())) && (qualifier == TQualifier::EvqPosition || qualifier == TQualifier::EvqFragCoord); 937 939 938 940 if (isInvariant) … … 1548 1550 case TOperator::EOpIndexIndirect: 1549 1551 { 1552 TType leftType = leftNode.getType(); 1550 1553 groupedTraverse(leftNode); 1551 1554 mOut << "["; 1552 rightNode.traverse(this); 1555 { 1556 mOut << "ANGLE_int_clamp("; 1557 groupedTraverse(rightNode); 1558 mOut << ", 0, "; 1559 if(leftType.isUnsizedArray()) 1560 { 1561 groupedTraverse(leftNode); 1562 mOut << ".size()"; 1563 } 1564 else 1565 { 1566 int maxSize; 1567 if (leftType.isArray()) 1568 { 1569 maxSize = static_cast<int>(leftType.getOutermostArraySize()) - 1; 1570 } 1571 else 1572 { 1573 maxSize = leftType.getNominalSize() - 1; 1574 } 1575 mOut << maxSize; 1576 } 1577 mOut << ")"; 1578 1579 } 1553 1580 mOut << "]"; 1554 1581 } … … 1869 1896 putAngle("texture2DLod"); 1870 1897 putAngle("texture2DProj"); 1898 putAngle("texture2DRect"); 1871 1899 putAngle("texture2DProjLod"); 1900 putAngle("texture2DRectProj"); 1872 1901 putAngle("texture3D"); 1873 1902 putAngle("texture3DLod"); -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp
r270733 r273188 299 299 300 300 const bool cond = type.getBasicType() == BT && !type.isArray() && 301 CompareBy(Cmp, type.getNominalSize(), MatchDim); 301 CompareBy(Cmp, type.getNominalSize(), MatchDim) && type.getQualifier() != TQualifier::EvqFragDepth; 302 302 303 303 304 if (cond) -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp
r270733 r273188 34 34 { 35 35 ALWAYS_INLINE(); 36 36 int_clamp(); 37 37 if (ppc.hasStructEq) 38 38 { … … 110 110 void matmulAssign(); 111 111 void atan(); 112 void int_clamp(); 112 113 void addMatrixScalarAssign(); 113 114 void subMatrixScalarAssign(); … … 130 131 void notEqualVector(); 131 132 void notEqualStruct(); 133 void notEqualMatrix(); 132 134 void equalArray(); 133 135 void notEqualArray(); … … 169 171 void texture2DProj(); 170 172 void texture2DProjLod(); 173 void texture2DRect(); 174 void texture2DRectProj(); 171 175 void texture3DLod(); 172 176 void texture3DProj(); … … 641 645 include_metal_common()) 642 646 647 PROGRAM_PRELUDE_DECLARE(int_clamp, 648 R"( 649 ANGLE_ALWAYS_INLINE int ANGLE_int_clamp(int value, int minValue, int maxValue) 650 { 651 return ((value < minValue) ? minValue : ((value > maxValue) ? maxValue : value)); 652 }; 653 )") 654 643 655 PROGRAM_PRELUDE_DECLARE(atan, 644 656 R"( … … 1055 1067 equalVector()) 1056 1068 1069 1057 1070 PROGRAM_PRELUDE_DECLARE(notEqualVector, 1058 1071 R"( … … 1064 1077 )", 1065 1078 equalVector()) 1079 1080 PROGRAM_PRELUDE_DECLARE(notEqualMatrix, 1081 R"( 1082 template <typename T, int C, int R> 1083 ANGLE_ALWAYS_INLINE bool ANGLE_notEqual(metal::matrix<T, C, R> u, metal::matrix<T, C, R> v) 1084 { 1085 return !ANGLE_equal(u, v); 1086 } 1087 )", 1088 equalMatrix()) 1089 1066 1090 1067 1091 PROGRAM_PRELUDE_DECLARE(notEqualStruct, … … 1753 1777 textureEnv()) 1754 1778 1779 PROGRAM_PRELUDE_DECLARE(texture2DRect, 1780 R"( 1781 #define ANGLE_texture2DRect(env, ...) ANGLE_texture2DRect_impl(*env.texture, *env.sampler, __VA_ARGS__) 1782 1783 template <typename Texture> 1784 ANGLE_ALWAYS_INLINE auto ANGLE_texture2DRect_impl( 1785 thread Texture &texture, 1786 thread metal::sampler const &sampler, 1787 thread metal::float2 const &coord) 1788 { 1789 return texture.sample(sampler, coord); 1790 } 1791 )", 1792 textureEnv()) 1793 1794 1755 1795 PROGRAM_PRELUDE_DECLARE(texture2DLod, 1756 1796 R"( … … 1795 1835 textureEnv()) 1796 1836 1837 PROGRAM_PRELUDE_DECLARE(texture2DRectProj, 1838 R"( 1839 #define ANGLE_texture2DRectProj(env, ...) ANGLE_texture2DRectProj_impl(*env.texture, *env.sampler, __VA_ARGS__) 1840 1841 template <typename Texture> 1842 ANGLE_ALWAYS_INLINE auto ANGLE_texture2DRectProj_impl( 1843 thread Texture &texture, 1844 thread metal::sampler const &sampler, 1845 thread metal::float3 const &coord) 1846 { 1847 return texture.sample(sampler, coord.xy/coord.z); 1848 } 1849 1850 template <typename Texture> 1851 ANGLE_ALWAYS_INLINE auto ANGLE_texture2DRectProj_impl( 1852 thread Texture &texture, 1853 thread metal::sampler const &sampler, 1854 thread metal::float4 const &coord) 1855 { 1856 return texture.sample(sampler, coord.xy/coord.w); 1857 } 1858 )", 1859 textureEnv()) 1860 1797 1861 PROGRAM_PRELUDE_DECLARE(texture2DProjLod, 1798 1862 R"( … … 1820 1884 )", 1821 1885 textureEnv()) 1886 1822 1887 1823 1888 PROGRAM_PRELUDE_DECLARE(texture3DLod, … … 2995 3060 putBuiltIn("texture2DLod", EMIT_METHOD(texture2DLod)); 2996 3061 putBuiltIn("texture2DProj", EMIT_METHOD(texture2DProj)); 3062 putBuiltIn("texture2DRect", EMIT_METHOD(texture2DRect)); 3063 putBuiltIn("texture2DRectProj", EMIT_METHOD(texture2DRectProj)); 2997 3064 putBuiltIn("texture3DLod", EMIT_METHOD(texture3DLod)); 2998 3065 putBuiltIn("texture3DProj", EMIT_METHOD(texture3DProj)); … … 3326 3393 equalArray(); 3327 3394 } 3395 if(argType0->isMatrix() && argType1->isMatrix()) 3396 { 3397 equalMatrix(); 3398 } 3328 3399 break; 3329 3400 … … 3341 3412 { 3342 3413 notEqualArray(); 3414 } 3415 if(argType0->isMatrix() && argType1->isMatrix()) 3416 { 3417 notEqualMatrix(); 3343 3418 } 3344 3419 break; -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp
r270733 r273188 8 8 #include <unordered_map> 9 9 10 #include "compiler/translator/TranslatorMetalDirect.h" 10 11 #include "compiler/translator/TranslatorMetalDirect/AstHelpers.h" 11 12 #include "compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h" … … 20 21 { 21 22 23 22 24 class Reducer : public TIntermRebuild 23 25 { 24 std::unordered_map<const TInterfaceBlock *, std::map<ImmutableString, const TVariable *>>26 std::unordered_map<const TInterfaceBlock *, const TVariable *> 25 27 mLiftedMap; 26 28 std::unordered_map<const TVariable *, const TVariable *> mInstanceMap; 29 IdGen &mIdGen; 27 30 28 public: 29 Reducer(TCompiler &compiler) : TIntermRebuild(compiler, true, false) {} 31 public: 32 Reducer(TCompiler &compiler, IdGen &idGen) 33 : TIntermRebuild(compiler, true, false), 34 mIdGen(idGen) 35 { 36 37 } 30 38 31 39 PreResult visitDeclarationPre(TIntermDeclaration &declNode) override … … 43 51 if (symbolType == SymbolType::Empty) 44 52 { 45 auto &nameToVar = mLiftedMap[interfaceBlock]; 46 std::vector<TIntermNode *> replacements; 47 for (TField *field : interfaceBlock->fields()) 48 { 49 auto &liftedType = CloneType(*field->type()); 50 ASSERT(liftedType.getQualifier() == TQualifier::EvqUniform || 51 liftedType.getQualifier() == TQualifier::EvqGlobal); 52 liftedType.setQualifier(TQualifier::EvqUniform); 53 auto *liftedVar = new TVariable(&mSymbolTable, field->name(), &liftedType, 54 field->symbolType()); 53 //Create instance variable 54 auto &structure = 55 *new TStructure(&mSymbolTable, interfaceBlock->name(), 56 &interfaceBlock->fields(), interfaceBlock->symbolType()); 57 auto &structVar = CreateStructTypeVariable(mSymbolTable, structure); 55 58 56 nameToVar[field->name()] = liftedVar; 59 auto &instanceVar = 60 CreateInstanceVariable(mSymbolTable, structure, mIdGen.createNewName(interfaceBlock->name()), 61 TQualifier::EvqBuffer, &type.getArraySizes()); 62 mLiftedMap[interfaceBlock] = &instanceVar; 57 63 58 replacements.push_back(59 new TIntermDeclaration{new TIntermSymbol(liftedVar)});60 }61 return PreResult::Multi(std:: move(replacements));64 TIntermNode *replacements[] = { 65 new TIntermDeclaration{new TIntermSymbol(&structVar)}, 66 new TIntermDeclaration{new TIntermSymbol(&instanceVar)}}; 67 return PreResult::Multi(std::begin(replacements), std::end(replacements)); 62 68 } 63 69 else … … 71 77 auto &instanceVar = 72 78 CreateInstanceVariable(mSymbolTable, structure, Name(var), 73 TQualifier::Evq Uniform, &type.getArraySizes());79 TQualifier::EvqBuffer, &type.getArraySizes()); 74 80 75 81 mInstanceMap[&var] = &instanceVar; … … 101 107 if (it != mLiftedMap.end()) 102 108 { 103 auto *liftedVar = it->second[var.name()]; 104 ASSERT(liftedVar); 105 return *new TIntermSymbol(liftedVar); 109 return AccessField(*(it->second), var.name()); 106 110 } 107 111 } … … 114 118 //////////////////////////////////////////////////////////////////////////////// 115 119 116 bool sh::ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root )120 bool sh::ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root, IdGen & idGen) 117 121 { 118 Reducer reducer(compiler );122 Reducer reducer(compiler, idGen); 119 123 if (!reducer.rebuildRoot(root)) 120 124 { -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h
r270733 r273188 29 29 // struct Foo { int x; }; uniform Foo x; 30 30 // 31 ANGLE_NO_DISCARD bool ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root );31 ANGLE_NO_DISCARD bool ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root, IdGen & idGen); 32 32 33 33 } // namespace sh -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp
r270733 r273188 21 21 { 22 22 public: 23 std::unordered_map<int, TIntermSymbol *> replacementMap; 23 24 Separator(TSymbolTable &symbolTable) : TIntermTraverser(false, false, true, &symbolTable) {} 24 25 … … 45 46 46 47 TIntermSequence replacements; 48 TIntermSymbol * instanceSymbol = new TIntermSymbol(instanceVar); 47 49 replacements.push_back(new TIntermSymbol(structVar)); 48 replacements.push_back(new TIntermSymbol(instanceVar)); 50 replacements.push_back(instanceSymbol); 51 replacementMap[symbolNode->uniqueId().get()] = instanceSymbol; 49 52 mMultiReplacements.push_back( 50 53 NodeReplaceWithMultipleEntry(declNode, symbolNode, std::move(replacements))); … … 53 56 54 57 return false; 58 } 59 60 void visitSymbol(TIntermSymbol *decl) override 61 { 62 auto symbol = replacementMap.find(decl->uniqueId().get()); 63 if(symbol != replacementMap.end()) 64 { 65 queueReplacement(symbol->second->deepCopy(), OriginalNode::IS_DROPPED); 66 } 55 67 } 56 68 }; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/load_functions_table_autogen.cpp
r270733 r273188 2 2 // Generated by gen_load_functions_table.py using data from load_functions_data.json 3 3 // 4 // Copyright 202 0The ANGLE Project Authors. All rights reserved.4 // Copyright 2021 The ANGLE Project Authors. All rights reserved. 5 5 // Use of this source code is governed by a BSD-style license that can be 6 6 // found in the LICENSE file. -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm
r270733 r273188 659 659 size_t convertedOffset = 0; 660 660 gl::DrawElementsType convertedType = type; 661 size_t convertedCount = (size_t)count;662 663 661 ANGLE_TRY(mVertexArray->getIndexBuffer(context, type, mode, count, indices, &idxBuffer, 664 &convertedOffset, &convertedType , &convertedCount));662 &convertedOffset, &convertedType)); 665 663 666 664 ASSERT(idxBuffer); 667 665 ASSERT((convertedOffset % mtl::kIndexBufferOffsetAlignment) == 0); 668 uint32_t convertedCounti32 = (uint32_t)co nvertedCount;666 uint32_t convertedCounti32 = (uint32_t)count; 669 667 if (mState.isTransformFeedbackActiveUnpaused()) 670 668 { -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.h
r270733 r273188 103 103 ContextMtl *contextMTL; 104 104 IOSurfaceRef mIOSurface; 105 GLint mGLInternalFormat; 105 106 mtl::TextureRef mIOSurfaceTexture; 106 107 mtl::TextureRef mIOSurfaceTextureView; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm
r270733 r273188 261 261 mFormat = display->getPixelFormat(kIOSurfaceFormats[mFormatIndex].pixelFormat); 262 262 mInternalFormat = display->getPixelFormat(kIOSurfaceFormats[mFormatIndex].internalPixelFormat); 263 mGLInternalFormat = kIOSurfaceFormats[mFormatIndex].internalFormat; 263 264 } 264 265 … … 431 432 mTemporarySurfaceRef->createViewWithDifferentFormat(MTLPixelFormatBGRA8Unorm); 432 433 mRenderTarget.set(mIOSurfaceTexture, mtl::kZeroNativeMipLevel, 0, mInternalFormat); 434 435 if (mGLInternalFormat == GL_RGB) 436 { 437 // Disable subsequent rendering to alpha channel. 438 // TODO: Investigate if this allows the higher level alpha masks can 439 // be disabled once this backend is live. 440 mIOSurfaceTexture->setColorWritableMask(MTLColorWriteMaskAll & (~MTLColorWriteMaskAlpha)); 441 } 442 433 443 mIOSurfaceTextureCreated = true; 434 444 return angle::Result::Continue; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/RenderBufferMtl.mm
r273137 r273188 111 111 // we need to initialize their content. 112 112 bool emulatedChannels = mtl::IsFormatEmulated(mFormat); 113 bool isDepthStencil = mFormat.hasDepthOrStencilBits(); 113 114 if (emulatedChannels) 114 115 { … … 131 132 } 132 133 } // if (emulatedChannels) 134 if(isDepthStencil) 135 { 136 gl::ImageIndex index; 137 138 if (actualSamples > 1) 139 { 140 index = gl::ImageIndex::Make2DMultisample(); 141 } 142 else 143 { 144 index = gl::ImageIndex::Make2D(0); 145 } 146 ANGLE_TRY(mtl::InitializeDepthStencilTextureContentsGPU(context, mTexture, mFormat, mtl::ImageNativeIndex(index, 0))); 147 if (mImplicitMSTexture) 148 { 149 ANGLE_TRY(mtl::InitializeDepthStencilTextureContentsGPU(context, mImplicitMSTexture, mFormat, 150 mtl::ImageNativeIndex(gl::ImageIndex::Make2DMultisample(), 0))); 151 } 152 } 133 153 } 134 154 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.h
r270733 r273188 59 59 mtl::BufferRef *idxBufferOut, 60 60 size_t *idxBufferOffsetOut, 61 gl::DrawElementsType *indexTypeOut, 62 size_t *indexBufferCountOut); 61 gl::DrawElementsType *indexTypeOut); 63 62 64 63 // Use to emulate instanced draw for instance <instanceId>. … … 90 89 size_t offset, 91 90 mtl::BufferRef *idxBufferOut, 92 size_t *idxBufferOffsetOut, 93 size_t *indexBufferCountOut); 91 size_t *idxBufferOffsetOut); 94 92 angle::Result streamIndexBufferFromClient(const gl::Context *glContext, 95 93 gl::DrawElementsType indexType, … … 98 96 const void *sourcePointer, 99 97 mtl::BufferRef *idxBufferOut, 100 size_t *idxBufferOffsetOut, 101 size_t *idxBufferCountOut); 98 size_t *idxBufferOffsetOut); 102 99 103 100 angle::Result convertIndexBufferGPU(const gl::Context *glContext, -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm
r270733 r273188 83 83 bool primitiveRestartEnabled, 84 84 mtl::BufferRef *bufferOut, 85 size_t *bufferOffsetOut, 86 size_t *indexCountOut) 85 size_t *bufferOffsetOut) 87 86 { 88 87 dynamicBuffer->releaseInFlightBuffers(contextMtl); … … 125 124 memcpy(dst, sourcePointer, amount); 126 125 } 127 *indexCountOut = indexCount;128 126 ANGLE_TRY(dynamicBuffer->commit(contextMtl)); 129 127 … … 704 702 mtl::BufferRef *idxBufferOut, 705 703 size_t *idxBufferOffsetOut, 706 gl::DrawElementsType *indexTypeOut, 707 size_t *indexBufferCountOut) 704 gl::DrawElementsType *indexTypeOut) 708 705 { 709 706 const gl::Buffer *glElementArrayBuffer = getState().getElementArrayBuffer(); … … 713 710 { 714 711 ANGLE_TRY(streamIndexBufferFromClient(context, type, mode, count, indices, idxBufferOut, 715 idxBufferOffsetOut , indexBufferCountOut));712 idxBufferOffsetOut)); 716 713 } 717 714 else … … 722 719 { 723 720 ANGLE_TRY(convertIndexBuffer(context, type, mode, convertedOffset, idxBufferOut, 724 idxBufferOffsetOut , indexBufferCountOut));721 idxBufferOffsetOut)); 725 722 } 726 723 else … … 730 727 *idxBufferOut = bufferMtl->getCurrentBuffer(); 731 728 *idxBufferOffsetOut = convertedOffset; 732 *indexBufferCountOut = count;729 733 730 } 734 731 } … … 749 746 size_t offset, 750 747 mtl::BufferRef *idxBufferOut, 751 size_t *idxBufferOffsetOut, 752 size_t *indexBufferCountOut) 748 size_t *idxBufferOffsetOut) 753 749 { 754 750 size_t offsetModulo = offset % mtl::kIndexBufferOffsetAlignment; … … 786 782 idxBuffer->getClientShadowCopyData(contextMtl) + offsetModulo, 787 783 indexType, indexCount, mode, glState.isPrimitiveRestartEnabled(), 788 &conversion->convertedBuffer, &conversion->convertedOffset, 789 indexBufferCountOut)); 784 &conversion->convertedBuffer, &conversion->convertedOffset)); 790 785 } 791 786 else … … 840 835 const void *sourcePointer, 841 836 mtl::BufferRef *idxBufferOut, 842 size_t *idxBufferOffsetOut, 843 size_t *idxBufferCountOut) 837 size_t *idxBufferOffsetOut) 844 838 { 845 839 ASSERT(getState().getElementArrayBuffer() == nullptr); … … 849 843 ANGLE_TRY(StreamIndexData(contextMtl, &mDynamicIndexData, srcData, indexType, indexCount, mode, 850 844 context->getState().isPrimitiveRestartEnabled(), idxBufferOut, 851 idxBufferOffsetOut , idxBufferCountOut));845 idxBufferOffsetOut)); 852 846 853 847 return angle::Result::Continue; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm
r270733 r273188 306 306 ContextMtl *contextMtl = mtl::GetImpl(context); 307 307 const angle::Format &angleFormat = textureObjFormat.actualAngleFormat(); 308 308 RenderTargetMtl rtMTL; 309 310 uint32_t layer = index.hasLayer() ? index.getLayerIndex() : 0; 311 rtMTL.set(texture, level, layer, textureObjFormat); 309 312 mtl::RenderPassDesc rpDesc; 310 311 uint32_t layer = index.hasLayer() ? index.getLayerIndex() : 0; 312 313 rtMTL.toRenderPassAttachmentDesc(&rpDesc.depthAttachment); 313 314 rpDesc.sampleCount = texture->samples(); 314 315 if (angleFormat.depthBits) 315 316 { 316 rpDesc.depthAttachment.renderTarget->texture = texture;317 rpDesc.depthAttachment.renderTarget->level = level;318 rpDesc.depthAttachment.renderTarget->sliceOrDepth = layer;319 317 rpDesc.depthAttachment.loadAction = MTLLoadActionClear; 320 318 rpDesc.depthAttachment.clearDepth = 1.0; … … 322 320 if (angleFormat.stencilBits) 323 321 { 324 rpDesc.stencilAttachment.renderTarget->texture = texture;325 rpDesc.stencilAttachment.renderTarget->level = level;326 rpDesc.stencilAttachment.renderTarget->sliceOrDepth = layer;327 322 rpDesc.stencilAttachment.loadAction = MTLLoadActionClear; 328 323 } -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/blit.metal
r270733 r273188 33 33 int srcLevel; // Source texture level. 34 34 int srcLayer; // Source texture layer. 35 35 int srcLevel2; // Source texture level. 36 int srcLayer2; // Source texture layer. 36 37 bool dstFlipViewportX; 37 38 bool dstFlipViewportY; 38 39 bool dstLuminance; // destination texture is luminance. Unused by depth & stencil blitting. 40 uint8_t padding[9]; 39 41 }; 40 42 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc
r270351 r273188 320 320 int srcLevel; 321 321 int srcLayer; 322 322 int srcLevel2; 323 int srcLayer2; 323 324 bool dstFlipViewportX; 324 325 bool dstFlipViewportY;
Note: See TracChangeset
for help on using the changeset viewer.