Changeset 276507 in webkit
- Timestamp:
- Apr 23, 2021, 11:15:55 AM (5 years ago)
- Location:
- trunk/Source/ThirdParty/ANGLE
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
src/libANGLE/renderer/metal/TextureMtl.mm (modified) (6 diffs)
-
src/libANGLE/renderer/metal/mtl_utils.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/ThirdParty/ANGLE/ChangeLog
r276466 r276507 1 2021-04-23 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, reverting r276190. 4 5 broke a test internally. 6 7 Reverted changeset: 8 9 "Metal-ANGLE: Shared memory texture tests failing in iOS 10 Simulator" 11 https://bugs.webkit.org/show_bug.cgi?id=222685 12 https://commits.webkit.org/r276190 13 1 14 2021-04-22 Lauro Moura <lmoura@igalia.com> 2 15 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm
r276190 r276507 175 175 } 176 176 177 178 #if TARGET_OS_SIMULATOR179 void CopyTextureData(const MTLSize ®ionSize,180 size_t srcRowPitch,181 size_t src2DImageSize,182 const uint8_t *psrc,183 size_t destRowPitch,184 size_t dest2DImageSize,185 uint8_t *pdst)186 {187 {188 size_t rowCopySize = std::min(srcRowPitch, destRowPitch);189 for (NSUInteger d = 0; d < regionSize.depth; ++d)190 {191 for (NSUInteger r = 0; r < regionSize.height; ++r)192 {193 const uint8_t *pCopySrc = psrc + d * src2DImageSize + r * srcRowPitch;194 uint8_t *pCopyDst = pdst + d * dest2DImageSize + r * destRowPitch;195 memcpy(pCopyDst, pCopySrc, rowCopySize);196 }197 }198 }199 }200 #endif201 202 177 void ConvertDepthStencilData(const MTLSize ®ionSize, 203 178 const angle::Format &srcAngleFormat, … … 291 266 return angle::Result::Continue; 292 267 } 293 294 #if TARGET_OS_SIMULATOR295 angle::Result CopyTextureContentsToStagingBuffer(296 ContextMtl *contextMtl,297 const angle::Format &textureAngleFormat,298 const MTLSize ®ionSize,299 const uint8_t *data,300 size_t bytesPerRow,301 size_t bytesPer2DImage,302 size_t *bufferRowPitchOut,303 size_t *buffer2DImageSizeOut,304 mtl::BufferRef *bufferOut)305 {306 size_t stagingBufferRowPitch = regionSize.width * textureAngleFormat.pixelBytes;307 size_t stagingBuffer2DImageSize = stagingBufferRowPitch * regionSize.height;308 size_t stagingBufferSize = stagingBuffer2DImageSize * regionSize.depth;309 mtl::BufferRef stagingBuffer;310 ANGLE_TRY(mtl::Buffer::MakeBuffer(contextMtl, stagingBufferSize, nullptr, &stagingBuffer));311 312 uint8_t *pdst = stagingBuffer->map(contextMtl);313 314 CopyTextureData(regionSize, bytesPerRow, bytesPer2DImage,315 data, stagingBufferRowPitch, stagingBuffer2DImageSize, pdst);316 317 stagingBuffer->unmap(contextMtl);318 319 *bufferOut = stagingBuffer;320 *bufferRowPitchOut = stagingBufferRowPitch;321 *buffer2DImageSizeOut = stagingBuffer2DImageSize;322 323 return angle::Result::Continue;324 }325 #endif326 268 327 269 angle::Result UploadDepthStencilTextureContentsWithStagingBuffer( … … 437 379 } 438 380 439 #if TARGET_OS_SIMULATOR440 angle::Result UploadTextureContentsWithStagingBuffer(441 ContextMtl *contextMtl,442 const angle::Format &textureAngleFormat,443 MTLRegion region,444 const mtl::MipmapNativeLevel &mipmapLevel,445 uint32_t slice,446 const uint8_t *data,447 size_t bytesPerRow,448 size_t bytesPer2DImage,449 const mtl::TextureRef &texture)450 {451 ASSERT(texture && texture->valid());452 453 angle::FormatID stagingBufferFormatID = textureAngleFormat.id;454 const angle::Format &angleStagingFormat = angle::Format::Get(stagingBufferFormatID);455 456 457 size_t stagingBufferRowPitch;458 size_t stagingBuffer2DImageSize;459 mtl::BufferRef stagingBuffer;460 461 // Copy depth data to staging depth buffer462 ANGLE_TRY(CopyTextureContentsToStagingBuffer(contextMtl, angleStagingFormat, region.size, data, bytesPerRow, bytesPer2DImage, &stagingBufferRowPitch, &stagingBuffer2DImageSize, &stagingBuffer));463 mtl::BlitCommandEncoder *encoder = contextMtl->getBlitCommandEncoder();464 465 encoder->copyBufferToTexture(stagingBuffer, 0, stagingBufferRowPitch,466 stagingBuffer2DImageSize, region.size, texture, slice,467 mipmapLevel, region.origin, 0);468 469 470 return angle::Result::Continue;471 }472 #endif473 474 381 angle::Result UploadTextureContents(const gl::Context *context, 475 382 const angle::Format &textureAngleFormat, … … 484 391 ASSERT(texture && texture->valid()); 485 392 ContextMtl *contextMtl = mtl::GetImpl(context); 486 #if TARGET_OS_SIMULATOR 487 if (!textureAngleFormat.depthBits && !textureAngleFormat.stencilBits) 488 { 489 ANGLE_TRY(UploadTextureContentsWithStagingBuffer(contextMtl,textureAngleFormat,region,mipmapLevel,slice,data,bytesPerRow,bytesPer2DImage,texture)); 490 return angle::Result::Continue; 491 } 492 #else 393 493 394 if (texture->isCPUAccessible()) 494 395 { … … 499 400 return angle::Result::Continue; 500 401 } 501 #endif 402 502 403 ASSERT(textureAngleFormat.depthBits || textureAngleFormat.stencilBits); 503 404 … … 517 418 518 419 return angle::Result::Continue; 519 520 420 } 521 421 -
trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm
r276190 r276507 114 114 const angle::Format &actualAngleFormat = textureObjFormat.actualAngleFormat(); 115 115 const gl::InternalFormat &intendedInternalFormat = textureObjFormat.intendedInternalFormat(); 116 bool forceGPUInitialization = false; 117 #if TARGET_OS_SIMULATOR 118 forceGPUInitialization = true; 119 #endif 116 120 117 // This function is called in many places to initialize the content of a texture. 121 118 // So it's better we do the sanity check here instead of let the callers do it themselves: … … 152 149 153 150 if (texture->isCPUAccessible() && index.getType() != gl::TextureType::_2DMultisample && 154 index.getType() != gl::TextureType::_2DMultisampleArray && forceGPUInitialization == false)151 index.getType() != gl::TextureType::_2DMultisampleArray) 155 152 { 156 153 const angle::Format &dstFormat = angle::Format::Get(textureObjFormat.actualFormatId); … … 202 199 } 203 200 } // if (texture->isCPUAccessible()) 204 205 201 else 206 202 {
Note:
See TracChangeset
for help on using the changeset viewer.