Changeset 278298 in webkit
- Timestamp:
- Jun 1, 2021, 1:01:43 AM (4 years ago)
- Location:
- trunk/Source/ThirdParty/ANGLE
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/ChangeLog
r278296 r278298 1 2021-06-01 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 ANGLE Metal translator pre-rotation code is unused and it asserts when used 4 https://bugs.webkit.org/show_bug.cgi?id=226262 5 6 Reviewed by Dean Jackson. 7 8 Remove the pre-rotation code. It is Android specific and most likely it is useful 9 only when ANGLE is used as the drawing mechanism for the primary app window picture. 10 Thus most likely it is not useful in WebKit on Cocoa platforms where the window 11 server does the compositing. 12 13 * src/compiler/translator/TranslatorMetalDirect.cpp: 14 (sh::TranslatorMetalDirect::translateImpl): 15 * src/compiler/translator/TranslatorMetalDirect.h: 16 * src/libANGLE/renderer/metal/ContextMtl.h: 17 * src/libANGLE/renderer/metal/ContextMtl.mm: 18 (rx::ContextMtl::handleDirtyDriverUniforms): 19 1 20 2021-05-31 Kimmo Kinnunen <kkinnunen@apple.com> 2 21 -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.cpp
r275841 r278298 79 79 StaticType::Get<EbtUInt, EbpHigh, EvqVertexID, 1, 1>()); 80 80 81 82 constexpr size_t kNumGraphicsDriverUniforms = 1 2;81 // Keep this list in sync with ContextMtl::DriverUniforms. 82 constexpr size_t kNumGraphicsDriverUniforms = 10; 83 83 constexpr std::array<const char *, kNumGraphicsDriverUniforms> kGraphicsDriverUniformNames = { 84 84 {kViewport, kHalfRenderArea, kFlipXY, kNegFlipXY, kClipDistancesEnabled, kXfbActiveUnpaused, 85 kXfbVerticesPerDraw, kXfbBufferOffsets, kAcbBufferOffsets, kDepthRange, kPreRotation, 86 kFragRotation}}; 85 kXfbVerticesPerDraw, kXfbBufferOffsets, kAcbBufferOffsets, kDepthRange}}; 87 86 88 87 constexpr size_t kNumComputeDriverUniforms = 1; … … 345 344 .getStruct(); 346 345 347 // This field list mirrors the structure of GraphicsDriverUniforms in Context Vk.cpp.346 // This field list mirrors the structure of GraphicsDriverUniforms in ContextMtl.cpp. 348 347 TFieldList *driverFieldList = new TFieldList; 349 348 … … 360 359 new TType(EbtUInt, 4), 361 360 new TType(emulatedDepthRangeParams, false), 362 new TType(EbtFloat, 2, 4),363 new TType(EbtFloat, 2, 4),364 361 }}; 365 362 … … 455 452 } 456 453 457 // This operation performs Android pre-rotation and y-flip. For Android (and potentially other458 // platforms), the device may rotate, such that the orientation of the application is rotated459 // relative to the native orientation of the device. This is corrected in part by multiplying460 // gl_Position by a mat2.461 // The equations reduce to an expression:462 //463 // gl_Position.xy = gl_Position.xy * preRotation464 ANGLE_NO_DISCARD bool AppendPreRotation(TCompiler &compiler,465 TIntermBlock &root,466 const TVariable &driverUniforms)467 {468 TSymbolTable &symbolTable = compiler.getSymbolTable();469 TIntermBinary *preRotationRef = CreateDriverUniformRef(driverUniforms, kPreRotation);470 TIntermSymbol *glPos = new TIntermSymbol(BuiltInVariable::gl_Position());471 TVector<int> swizzleOffsetXY = {0, 1};472 TIntermSwizzle *glPosXY = new TIntermSwizzle(glPos, swizzleOffsetXY);473 474 // Create the expression "(gl_Position.xy * preRotation)"475 TIntermBinary *zRotated =476 new TIntermBinary(EOpMatrixTimesVector, preRotationRef->deepCopy(), glPosXY->deepCopy());477 478 // Create the assignment "gl_Position.xy = (gl_Position.xy * preRotation)"479 TIntermBinary *assignment =480 new TIntermBinary(TOperator::EOpAssign, glPosXY->deepCopy(), zRotated);481 482 // Append the assignment as a statement at the end of the shader.483 return RunAtTheEndOfShader(&compiler, &root, assignment, &symbolTable);484 }485 486 454 ANGLE_NO_DISCARD bool RotateAndFlipBuiltinVariable(TCompiler &compiler, 487 455 TIntermBlock &root, … … 562 530 TIntermBinary &flipXY = *CreateDriverUniformRef(driverUniforms, kFlipXY); 563 531 TIntermBinary &pivot = *CreateDriverUniformRef(driverUniforms, kHalfRenderArea); 564 TIntermBinary *fragRotation = (compileOptions & SH_ADD_PRE_ROTATION) 565 ? CreateDriverUniformRef(driverUniforms, kFragRotation) 566 : nullptr; 532 TIntermBinary *fragRotation = nullptr; 567 533 return RotateAndFlipBuiltinVariable(compiler, root, insertSequence, flipXY, 568 534 *BuiltInVariable::gl_FragCoord(), kFlippedFragCoordName, … … 1264 1230 #endif 1265 1231 1266 bool usePreRotation = compileOptions & SH_ADD_PRE_ROTATION;1267 1268 1232 if (usesPointCoord) 1269 1233 { 1270 1234 TIntermBinary &flipXY = *CreateDriverUniformRef(driverUniforms, kNegFlipXY); 1271 1235 TIntermConstantUnion &pivot = *CreateFloatNode(0.5f); 1272 TIntermBinary *fragRotation = 1273 usePreRotation ? CreateDriverUniformRef(driverUniforms, kFragRotation) : nullptr; 1236 TIntermBinary *fragRotation = nullptr; 1274 1237 if (!RotateAndFlipBuiltinVariable(*this, root, *GetMainSequence(root), flipXY, 1275 1238 *BuiltInVariable::gl_PointCoord(), … … 1293 1256 { 1294 1257 TIntermBinary *flipXY = CreateDriverUniformRef(driverUniforms, kFlipXY); 1295 TIntermBinary *fragRotation = 1296 usePreRotation ? CreateDriverUniformRef(driverUniforms, kFragRotation) : nullptr; 1258 TIntermBinary *fragRotation = nullptr; 1297 1259 if (!RewriteDfdy(this, &root, symbolTable, getShaderVersion(), flipXY, fragRotation)) 1298 1260 { … … 1368 1330 return false; 1369 1331 } 1370 1371 1372 1373 if ((compileOptions & SH_ADD_PRE_ROTATION) != 0 &&1374 !AppendPreRotation(*this, root, driverUniforms))1375 {1376 return false;1377 }1378 1332 } 1379 1333 else if (getShaderType() == GL_GEOMETRY_SHADER) -
trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect.h
r278192 r278298 24 24 constexpr const char kAcbBufferOffsets[] = "acbBufferOffsets"; 25 25 constexpr const char kDepthRange[] = "depthRange"; 26 constexpr const char kPreRotation[] = "preRotation";27 constexpr const char kFragRotation[] = "fragRotation";28 26 constexpr const char kUnassignedAttributeString[] = " __unassigned_attribute__"; 29 27 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.h
r277824 r278298 501 501 }; 502 502 503 // See compiler/translator/TranslatorVulkan.cpp: AddDriverUniformsToShader()503 // Keep this in sync with TranslatorMetalDirect.cpp: kGraphicsDriverUniformNames. 504 504 struct DriverUniforms 505 505 { … … 523 523 // We'll use x, y, z, w for near / far / diff / zscale respectively. 524 524 float depthRange[4]; 525 526 // Used to pre-rotate gl_Position for Vulkan swapchain images on Android (a mat2, which is527 // padded to the size of two vec4's).528 // Unused in Metal.529 float preRotation[8] = {};530 531 // Used to pre-rotate gl_FragCoord for Vulkan swapchain images on Android (a mat2, which is532 // padded to the size of two vec4's).533 // Unused in Metal.534 float fragRotation[8] = {};535 525 536 526 uint32_t coverageMask; -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm
r278152 r278298 2299 2299 mDriverUniforms.depthRange[3] = NeedToInvertDepthRange(depthRangeNear, depthRangeFar) ? -1 : 1; 2300 2300 2301 // NOTE(hqle): preRotation & fragRotation are unused.2302 2303 2301 // Sample coverage mask 2304 2302 uint32_t sampleBitCount = mDrawFramebuffer->getSamples();
Note:
See TracChangeset
for help on using the changeset viewer.