Changeset 273189 in webkit
- Timestamp:
- Feb 19, 2021 7:06:00 PM (3 years ago)
- Location:
- trunk/Source/ThirdParty/ANGLE
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
r273188 r273189 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 */; };1186 1183 FF81FED025818D6800894E24 /* mtl_glslang_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */; }; 1187 1184 FF81FED125818D6800894E24 /* ProgramMtl.h in Headers */ = {isa = PBXBuildFile; fileRef = FF81FE8125818D6800894E24 /* ProgramMtl.h */; }; … … 1319 1316 FF81FFA32581AD0400894E24 /* gen_mipmap.metal in Sources */ = {isa = PBXBuildFile; fileRef = FF81FEB225818D6800894E24 /* gen_mipmap.metal */; }; 1320 1317 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 */; };1323 1318 /* End PBXBuildFile section */ 1324 1319 … … 2171 2166 FB39D0D11200F0E300088E69 /* libANGLE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libANGLE.a; sourceTree = BUILT_PRODUCTS_DIR; }; 2172 2167 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>"; };2175 2168 FF81FE8025818D6800894E24 /* mtl_glslang_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mtl_glslang_utils.h; sourceTree = "<group>"; }; 2176 2169 FF81FE8125818D6800894E24 /* ProgramMtl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgramMtl.h; sourceTree = "<group>"; }; … … 2310 2303 FF81FF992581A3C100894E24 /* IntermRebuild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermRebuild.cpp; sourceTree = "<group>"; }; 2311 2304 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>"; };2314 2305 /* End PBXFileReference section */ 2315 2306 … … 3583 3574 FF81FF522581919700894E24 /* EmitMetal.h */, 3584 3575 FF81FF282581919700894E24 /* EnvironmentVariable.h */, 3585 FF2D2F5325C8B14A002FB699 /* FixTypeConstructors.cpp */,3586 FF2D2F5225C8B14A002FB699 /* FixTypeConstructors.h */,3587 3576 FF81FF482581919700894E24 /* HoistConstants.cpp */, 3588 3577 FF81FF4C2581919700894E24 /* HoistConstants.h */, … … 3599 3588 FF81FF212581919700894E24 /* Name.cpp */, 3600 3589 FF81FF242581919700894E24 /* Name.h */, 3601 FFA0C2C525CB6A7600105306 /* NameEmbeddedUniformStructsMetal.cpp */,3602 FFA0C2C625CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h */,3603 3590 FF81FF372581919700894E24 /* Pipeline.cpp */, 3604 3591 FF81FF492581919700894E24 /* Pipeline.h */, … … 3751 3738 31CDFFB6249184A100486F27 /* FindSymbolNode.h in Headers */, 3752 3739 31CDFF682491848C00486F27 /* FixedVector.h in Headers */, 3753 FF2D2F5525C8B14A002FB699 /* FixTypeConstructors.h in Headers */,3754 3740 A3C49C16255DF866005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */, 3755 3741 31CDFFC0249184A700486F27 /* FlagStd140Structs.h in Headers */, … … 4184 4170 5C55D6FB22826CB300B5BA2C /* FindSymbolNode.h in Headers */, 4185 4171 5C55D7282282747700B5BA2C /* FixedVector.h in Headers */, 4186 FF2D2F5425C8B14A002FB699 /* FixTypeConstructors.h in Headers */,4187 4172 A3C49C12255DF865005E8DF7 /* FlagSamplersWithTexelFetch.h in Headers */, 4188 4173 5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */, … … 4290 4275 FF81FF5E2581919700894E24 /* Name.h in Headers */, 4291 4276 5C55D66922826B9F00B5BA2C /* NameEmbeddedUniformStructs.h in Headers */, 4292 FFA0C2C825CB6A7700105306 /* NameEmbeddedUniformStructsMetal.h in Headers */,4293 4277 A303070B2305F6B5002DA972 /* no_destructor.h in Headers */, 4294 4278 5C55D70722826CB300B5BA2C /* NodeSearch.h in Headers */, … … 4763 4747 5C55D6FD22826CB300B5BA2C /* FindMain.cpp in Sources */, 4764 4748 5C55D70322826CB300B5BA2C /* FindSymbolNode.cpp in Sources */, 4765 FF2D2F5625C8B14A002FB699 /* FixTypeConstructors.cpp in Sources */,4766 4749 A3C49C0B255DF85F005E8DF7 /* FlagSamplersWithTexelFetch.cpp in Sources */, 4767 4750 5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */, … … 4846 4829 FF81FF5B2581919700894E24 /* Name.cpp in Sources */, 4847 4830 5C55D6B622826BC800B5BA2C /* NameEmbeddedUniformStructs.cpp in Sources */, 4848 FFA0C2C725CB6A7700105306 /* NameEmbeddedUniformStructsMetal.cpp in Sources */,4849 4831 315EBDBF1FCE44BF00AC7A89 /* null_functions.cpp in Sources */, 4850 4832 5CCD59692284F7960018F2D8 /* Observer.cpp in Sources */, -
trunk/Source/ThirdParty/ANGLE/ChangeLog
r273188 r273189 1 2021-02-19 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, reverting r273188. 4 5 Broke the build: Is missing a cpp file 6 7 Reverted changeset: 8 9 "Fix a number of functional regressions caused by enabling the 10 Metal ANGLE backend by default." 11 https://bugs.webkit.org/show_bug.cgi?id=220895 12 https://commits.webkit.org/r273188 13 1 14 2021-02-19 Kyle Piddington <kpiddington@apple.com> 2 15 -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp
r273188 r273189 28 28 #include "compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.h" 29 29 #include "compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.h" 30 #include "compiler/translator/TranslatorMetalDirect/FixTypeConstructors.h"31 30 #include "compiler/translator/TranslatorMetalDirect/SymbolEnv.h" 32 31 #include "compiler/translator/TranslatorMetalDirect/ToposortStructs.h" … … 34 33 #include "compiler/translator/TranslatorMetalUtils.h" 35 34 #include "compiler/translator/tree_ops/InitializeVariables.h" 36 #include "compiler/translator/ TranslatorMetalDirect/NameEmbeddedUniformStructsMetal.h"35 #include "compiler/translator/tree_ops/NameEmbeddedUniformStructs.h" 37 36 #include "compiler/translator/tree_ops/RemoveAtomicCounterBuiltins.h" 38 37 #include "compiler/translator/tree_ops/RemoveInactiveInterfaceVariables.h" … … 602 601 root.insertChildNodes(FindMainIndex(&root), 603 602 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);617 603 } 618 604 … … 954 940 if (aggregateTypesUsedForUniforms > 0) 955 941 { 956 if (!NameEmbeddedStructUniforms Metal(this, &root, &symbolTable))942 if (!NameEmbeddedStructUniforms(this, &root, &symbolTable)) 957 943 { 958 944 return false; … … 1120 1106 bool usesFragData = false; 1121 1107 bool usesFragDepth = false; 1122 bool usesFragDepthEXT = false;1123 1108 for (const ShaderVariable &outputVarying : mOutputVariables) 1124 1109 { … … 1137 1122 usesFragDepth = true; 1138 1123 } 1139 else if (outputVarying.name == "gl_FragDepthEXT")1140 {1141 usesFragDepthEXT = true;1142 }1143 1124 } 1144 1125 } … … 1161 1142 } 1162 1143 } 1163 if(usesFragDepthEXT) 1164 { 1165 AddFragDepthEXTDeclaration(*this, root, symbolTable); 1166 } 1167 else if (usesFragDepth) 1144 1145 if (usesFragDepth) 1168 1146 { 1169 1147 AddFragDepthDeclaration(root, symbolTable); … … 1243 1221 DeclareRightBeforeMain(root, kgl_VertexIndexMetal); 1244 1222 } 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 }1254 1223 1255 1224 #if 0 … … 1351 1320 } 1352 1321 1353 if (!ReduceInterfaceBlocks(*this, root , idGen))1322 if (!ReduceInterfaceBlocks(*this, root)) 1354 1323 { 1355 1324 return false; … … 1409 1378 return false; 1410 1379 } 1411 if(!FixTypeConstructors(*this, symbolEnv, root))1412 {1413 return false;1414 }1415 1380 1416 1381 if (!ToposortStructs(*this, symbolEnv, root, ppc)) … … 1418 1383 return false; 1419 1384 } 1420 1385 1421 1386 if (!EmitMetal(*this, root, idGen, pipelineStructs, invariants, symbolEnv, ppc)) 1422 1387 { -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp
r273188 r273189 356 356 if ((argType0->isVector() && argType1->isVector()) || 357 357 (argType0->getStruct() && argType1->getStruct()) || 358 (argType0->isArray() && argType1->isArray()) || 359 (argType0->isMatrix() && argType1->isMatrix())) 358 (argType0->isArray() && argType1->isArray())) 360 359 361 360 { … … 367 366 case TOperator::EOpNotEqual: 368 367 if ((argType0->isVector() && argType1->isVector()) || 369 (argType0->isArray() && argType1->isArray())|| 370 (argType0->isMatrix() && argType1->isMatrix())) 368 (argType0->isArray() && argType1->isArray())) 371 369 { 372 370 return "ANGLE_notEqual"; … … 936 934 937 935 const bool isInvariant = 938 (decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable())) && (qualifier == TQualifier::EvqPosition || qualifier == TQualifier::EvqFragCoord);936 decl.isField() ? mInvariants.contains(decl.field()) : mInvariants.contains(decl.variable()); 939 937 940 938 if (isInvariant) … … 1550 1548 case TOperator::EOpIndexIndirect: 1551 1549 { 1552 TType leftType = leftNode.getType();1553 1550 groupedTraverse(leftNode); 1554 1551 mOut << "["; 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 } 1552 rightNode.traverse(this); 1580 1553 mOut << "]"; 1581 1554 } … … 1896 1869 putAngle("texture2DLod"); 1897 1870 putAngle("texture2DProj"); 1898 putAngle("texture2DRect");1899 1871 putAngle("texture2DProjLod"); 1900 putAngle("texture2DRectProj");1901 1872 putAngle("texture3D"); 1902 1873 putAngle("texture3DLod"); -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp
r273188 r273189 299 299 300 300 const bool cond = type.getBasicType() == BT && !type.isArray() && 301 CompareBy(Cmp, type.getNominalSize(), MatchDim) && type.getQualifier() != TQualifier::EvqFragDepth; 302 301 CompareBy(Cmp, type.getNominalSize(), MatchDim); 303 302 304 303 if (cond) -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp
r273188 r273189 34 34 { 35 35 ALWAYS_INLINE(); 36 int_clamp(); 36 37 37 if (ppc.hasStructEq) 38 38 { … … 110 110 void matmulAssign(); 111 111 void atan(); 112 void int_clamp();113 112 void addMatrixScalarAssign(); 114 113 void subMatrixScalarAssign(); … … 131 130 void notEqualVector(); 132 131 void notEqualStruct(); 133 void notEqualMatrix();134 132 void equalArray(); 135 133 void notEqualArray(); … … 171 169 void texture2DProj(); 172 170 void texture2DProjLod(); 173 void texture2DRect();174 void texture2DRectProj();175 171 void texture3DLod(); 176 172 void texture3DProj(); … … 645 641 include_metal_common()) 646 642 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 655 643 PROGRAM_PRELUDE_DECLARE(atan, 656 644 R"( … … 1067 1055 equalVector()) 1068 1056 1069 1070 1057 PROGRAM_PRELUDE_DECLARE(notEqualVector, 1071 1058 R"( … … 1077 1064 )", 1078 1065 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 1090 1066 1091 1067 PROGRAM_PRELUDE_DECLARE(notEqualStruct, … … 1777 1753 textureEnv()) 1778 1754 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 1795 1755 PROGRAM_PRELUDE_DECLARE(texture2DLod, 1796 1756 R"( … … 1835 1795 textureEnv()) 1836 1796 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 1861 1797 PROGRAM_PRELUDE_DECLARE(texture2DProjLod, 1862 1798 R"( … … 1884 1820 )", 1885 1821 textureEnv()) 1886 1887 1822 1888 1823 PROGRAM_PRELUDE_DECLARE(texture3DLod, … … 3060 2995 putBuiltIn("texture2DLod", EMIT_METHOD(texture2DLod)); 3061 2996 putBuiltIn("texture2DProj", EMIT_METHOD(texture2DProj)); 3062 putBuiltIn("texture2DRect", EMIT_METHOD(texture2DRect));3063 putBuiltIn("texture2DRectProj", EMIT_METHOD(texture2DRectProj));3064 2997 putBuiltIn("texture3DLod", EMIT_METHOD(texture3DLod)); 3065 2998 putBuiltIn("texture3DProj", EMIT_METHOD(texture3DProj)); … … 3393 3326 equalArray(); 3394 3327 } 3395 if(argType0->isMatrix() && argType1->isMatrix())3396 {3397 equalMatrix();3398 }3399 3328 break; 3400 3329 … … 3412 3341 { 3413 3342 notEqualArray(); 3414 }3415 if(argType0->isMatrix() && argType1->isMatrix())3416 {3417 notEqualMatrix();3418 3343 } 3419 3344 break; -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp
r273188 r273189 8 8 #include <unordered_map> 9 9 10 #include "compiler/translator/TranslatorMetalDirect.h"11 10 #include "compiler/translator/TranslatorMetalDirect/AstHelpers.h" 12 11 #include "compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h" … … 21 20 { 22 21 23 24 22 class Reducer : public TIntermRebuild 25 23 { 26 std::unordered_map<const TInterfaceBlock *, const TVariable *>24 std::unordered_map<const TInterfaceBlock *, std::map<ImmutableString, const TVariable *>> 27 25 mLiftedMap; 28 26 std::unordered_map<const TVariable *, const TVariable *> mInstanceMap; 29 IdGen &mIdGen;30 27 31 public: 32 Reducer(TCompiler &compiler, IdGen &idGen) 33 : TIntermRebuild(compiler, true, false), 34 mIdGen(idGen) 35 { 36 37 } 28 public: 29 Reducer(TCompiler &compiler) : TIntermRebuild(compiler, true, false) {} 38 30 39 31 PreResult visitDeclarationPre(TIntermDeclaration &declNode) override … … 51 43 if (symbolType == SymbolType::Empty) 52 44 { 53 //Create instance variable 54 auto &structure = 55 *new TStructure(&mSymbolTable, interfaceBlock->name(), 56 &interfaceBlock->fields(), interfaceBlock->symbolType()); 57 auto &structVar = CreateStructTypeVariable(mSymbolTable, structure); 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()); 58 55 59 auto &instanceVar = 60 CreateInstanceVariable(mSymbolTable, structure, mIdGen.createNewName(interfaceBlock->name()), 61 TQualifier::EvqBuffer, &type.getArraySizes()); 62 mLiftedMap[interfaceBlock] = &instanceVar; 56 nameToVar[field->name()] = liftedVar; 63 57 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));58 replacements.push_back( 59 new TIntermDeclaration{new TIntermSymbol(liftedVar)}); 60 } 61 return PreResult::Multi(std::move(replacements)); 68 62 } 69 63 else … … 77 71 auto &instanceVar = 78 72 CreateInstanceVariable(mSymbolTable, structure, Name(var), 79 TQualifier::Evq Buffer, &type.getArraySizes());73 TQualifier::EvqUniform, &type.getArraySizes()); 80 74 81 75 mInstanceMap[&var] = &instanceVar; … … 107 101 if (it != mLiftedMap.end()) 108 102 { 109 return AccessField(*(it->second), var.name()); 103 auto *liftedVar = it->second[var.name()]; 104 ASSERT(liftedVar); 105 return *new TIntermSymbol(liftedVar); 110 106 } 111 107 } … … 118 114 //////////////////////////////////////////////////////////////////////////////// 119 115 120 bool sh::ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root , IdGen & idGen)116 bool sh::ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root) 121 117 { 122 Reducer reducer(compiler , idGen);118 Reducer reducer(compiler); 123 119 if (!reducer.rebuildRoot(root)) 124 120 { -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h
r273188 r273189 29 29 // struct Foo { int x; }; uniform Foo x; 30 30 // 31 ANGLE_NO_DISCARD bool ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root , IdGen & idGen);31 ANGLE_NO_DISCARD bool ReduceInterfaceBlocks(TCompiler &compiler, TIntermBlock &root); 32 32 33 33 } // namespace sh -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp
r273188 r273189 21 21 { 22 22 public: 23 std::unordered_map<int, TIntermSymbol *> replacementMap;24 23 Separator(TSymbolTable &symbolTable) : TIntermTraverser(false, false, true, &symbolTable) {} 25 24 … … 46 45 47 46 TIntermSequence replacements; 48 TIntermSymbol * instanceSymbol = new TIntermSymbol(instanceVar);49 47 replacements.push_back(new TIntermSymbol(structVar)); 50 replacements.push_back(instanceSymbol); 51 replacementMap[symbolNode->uniqueId().get()] = instanceSymbol; 48 replacements.push_back(new TIntermSymbol(instanceVar)); 52 49 mMultiReplacements.push_back( 53 50 NodeReplaceWithMultipleEntry(declNode, symbolNode, std::move(replacements))); … … 56 53 57 54 return false; 58 }59 60 void visitSymbol(TIntermSymbol *decl) override61 {62 auto symbol = replacementMap.find(decl->uniqueId().get());63 if(symbol != replacementMap.end())64 {65 queueReplacement(symbol->second->deepCopy(), OriginalNode::IS_DROPPED);66 }67 55 } 68 56 }; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/load_functions_table_autogen.cpp
r273188 r273189 2 2 // Generated by gen_load_functions_table.py using data from load_functions_data.json 3 3 // 4 // Copyright 202 1The ANGLE Project Authors. All rights reserved.4 // Copyright 2020 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
r273188 r273189 659 659 size_t convertedOffset = 0; 660 660 gl::DrawElementsType convertedType = type; 661 size_t convertedCount = (size_t)count; 662 661 663 ANGLE_TRY(mVertexArray->getIndexBuffer(context, type, mode, count, indices, &idxBuffer, 662 &convertedOffset, &convertedType ));664 &convertedOffset, &convertedType, &convertedCount)); 663 665 664 666 ASSERT(idxBuffer); 665 667 ASSERT((convertedOffset % mtl::kIndexBufferOffsetAlignment) == 0); 666 uint32_t convertedCounti32 = (uint32_t)co unt;668 uint32_t convertedCounti32 = (uint32_t)convertedCount; 667 669 if (mState.isTransformFeedbackActiveUnpaused()) 668 670 { -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.h
r273188 r273189 103 103 ContextMtl *contextMTL; 104 104 IOSurfaceRef mIOSurface; 105 GLint mGLInternalFormat;106 105 mtl::TextureRef mIOSurfaceTexture; 107 106 mtl::TextureRef mIOSurfaceTextureView; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/IOSurfaceSurfaceMtl.mm
r273188 r273189 261 261 mFormat = display->getPixelFormat(kIOSurfaceFormats[mFormatIndex].pixelFormat); 262 262 mInternalFormat = display->getPixelFormat(kIOSurfaceFormats[mFormatIndex].internalPixelFormat); 263 mGLInternalFormat = kIOSurfaceFormats[mFormatIndex].internalFormat;264 263 } 265 264 … … 432 431 mTemporarySurfaceRef->createViewWithDifferentFormat(MTLPixelFormatBGRA8Unorm); 433 432 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 can439 // be disabled once this backend is live.440 mIOSurfaceTexture->setColorWritableMask(MTLColorWriteMaskAll & (~MTLColorWriteMaskAlpha));441 }442 443 433 mIOSurfaceTextureCreated = true; 444 434 return angle::Result::Continue; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/RenderBufferMtl.mm
r273188 r273189 111 111 // we need to initialize their content. 112 112 bool emulatedChannels = mtl::IsFormatEmulated(mFormat); 113 bool isDepthStencil = mFormat.hasDepthOrStencilBits();114 113 if (emulatedChannels) 115 114 { … … 132 131 } 133 132 } // if (emulatedChannels) 134 if(isDepthStencil)135 {136 gl::ImageIndex index;137 138 if (actualSamples > 1)139 {140 index = gl::ImageIndex::Make2DMultisample();141 }142 else143 {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 }153 133 } 154 134 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.h
r273188 r273189 59 59 mtl::BufferRef *idxBufferOut, 60 60 size_t *idxBufferOffsetOut, 61 gl::DrawElementsType *indexTypeOut); 61 gl::DrawElementsType *indexTypeOut, 62 size_t *indexBufferCountOut); 62 63 63 64 // Use to emulate instanced draw for instance <instanceId>. … … 89 90 size_t offset, 90 91 mtl::BufferRef *idxBufferOut, 91 size_t *idxBufferOffsetOut); 92 size_t *idxBufferOffsetOut, 93 size_t *indexBufferCountOut); 92 94 angle::Result streamIndexBufferFromClient(const gl::Context *glContext, 93 95 gl::DrawElementsType indexType, … … 96 98 const void *sourcePointer, 97 99 mtl::BufferRef *idxBufferOut, 98 size_t *idxBufferOffsetOut); 100 size_t *idxBufferOffsetOut, 101 size_t *idxBufferCountOut); 99 102 100 103 angle::Result convertIndexBufferGPU(const gl::Context *glContext, -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/VertexArrayMtl.mm
r273188 r273189 83 83 bool primitiveRestartEnabled, 84 84 mtl::BufferRef *bufferOut, 85 size_t *bufferOffsetOut) 85 size_t *bufferOffsetOut, 86 size_t *indexCountOut) 86 87 { 87 88 dynamicBuffer->releaseInFlightBuffers(contextMtl); … … 124 125 memcpy(dst, sourcePointer, amount); 125 126 } 127 *indexCountOut = indexCount; 126 128 ANGLE_TRY(dynamicBuffer->commit(contextMtl)); 127 129 … … 702 704 mtl::BufferRef *idxBufferOut, 703 705 size_t *idxBufferOffsetOut, 704 gl::DrawElementsType *indexTypeOut) 706 gl::DrawElementsType *indexTypeOut, 707 size_t *indexBufferCountOut) 705 708 { 706 709 const gl::Buffer *glElementArrayBuffer = getState().getElementArrayBuffer(); … … 710 713 { 711 714 ANGLE_TRY(streamIndexBufferFromClient(context, type, mode, count, indices, idxBufferOut, 712 idxBufferOffsetOut ));715 idxBufferOffsetOut, indexBufferCountOut)); 713 716 } 714 717 else … … 719 722 { 720 723 ANGLE_TRY(convertIndexBuffer(context, type, mode, convertedOffset, idxBufferOut, 721 idxBufferOffsetOut ));724 idxBufferOffsetOut, indexBufferCountOut)); 722 725 } 723 726 else … … 727 730 *idxBufferOut = bufferMtl->getCurrentBuffer(); 728 731 *idxBufferOffsetOut = convertedOffset; 729 732 *indexBufferCountOut = count; 730 733 } 731 734 } … … 746 749 size_t offset, 747 750 mtl::BufferRef *idxBufferOut, 748 size_t *idxBufferOffsetOut) 751 size_t *idxBufferOffsetOut, 752 size_t *indexBufferCountOut) 749 753 { 750 754 size_t offsetModulo = offset % mtl::kIndexBufferOffsetAlignment; … … 782 786 idxBuffer->getClientShadowCopyData(contextMtl) + offsetModulo, 783 787 indexType, indexCount, mode, glState.isPrimitiveRestartEnabled(), 784 &conversion->convertedBuffer, &conversion->convertedOffset)); 788 &conversion->convertedBuffer, &conversion->convertedOffset, 789 indexBufferCountOut)); 785 790 } 786 791 else … … 835 840 const void *sourcePointer, 836 841 mtl::BufferRef *idxBufferOut, 837 size_t *idxBufferOffsetOut) 842 size_t *idxBufferOffsetOut, 843 size_t *idxBufferCountOut) 838 844 { 839 845 ASSERT(getState().getElementArrayBuffer() == nullptr); … … 843 849 ANGLE_TRY(StreamIndexData(contextMtl, &mDynamicIndexData, srcData, indexType, indexCount, mode, 844 850 context->getState().isPrimitiveRestartEnabled(), idxBufferOut, 845 idxBufferOffsetOut ));851 idxBufferOffsetOut, idxBufferCountOut)); 846 852 847 853 return angle::Result::Continue; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm
r273188 r273189 306 306 ContextMtl *contextMtl = mtl::GetImpl(context); 307 307 const angle::Format &angleFormat = textureObjFormat.actualAngleFormat(); 308 RenderTargetMtl rtMTL; 308 309 mtl::RenderPassDesc rpDesc; 309 310 310 311 uint32_t layer = index.hasLayer() ? index.getLayerIndex() : 0; 311 rtMTL.set(texture, level, layer, textureObjFormat); 312 mtl::RenderPassDesc rpDesc; 313 rtMTL.toRenderPassAttachmentDesc(&rpDesc.depthAttachment); 312 314 313 rpDesc.sampleCount = texture->samples(); 315 314 if (angleFormat.depthBits) 316 315 { 316 rpDesc.depthAttachment.renderTarget->texture = texture; 317 rpDesc.depthAttachment.renderTarget->level = level; 318 rpDesc.depthAttachment.renderTarget->sliceOrDepth = layer; 317 319 rpDesc.depthAttachment.loadAction = MTLLoadActionClear; 318 320 rpDesc.depthAttachment.clearDepth = 1.0; … … 320 322 if (angleFormat.stencilBits) 321 323 { 324 rpDesc.stencilAttachment.renderTarget->texture = texture; 325 rpDesc.stencilAttachment.renderTarget->level = level; 326 rpDesc.stencilAttachment.renderTarget->sliceOrDepth = layer; 322 327 rpDesc.stencilAttachment.loadAction = MTLLoadActionClear; 323 328 } -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/blit.metal
r273188 r273189 33 33 int srcLevel; // Source texture level. 34 34 int srcLayer; // Source texture layer. 35 int srcLevel2; // Source texture level. 36 int srcLayer2; // Source texture layer. 35 37 36 bool dstFlipViewportX; 38 37 bool dstFlipViewportY; 39 38 bool dstLuminance; // destination texture is luminance. Unused by depth & stencil blitting. 40 uint8_t padding[9];41 39 }; 42 40 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc
r273188 r273189 320 320 int srcLevel; 321 321 int srcLayer; 322 int srcLevel2; 323 int srcLayer2; 322 324 323 bool dstFlipViewportX; 325 324 bool dstFlipViewportY;
Note: See TracChangeset
for help on using the changeset viewer.