Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm (276506 => 276507)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm 2021-04-23 17:44:03 UTC (rev 276506)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm 2021-04-23 18:15:55 UTC (rev 276507)
@@ -174,31 +174,6 @@
*dst = gl::floatToNormalized<24, uint32_t>(static_cast<float>(src->depth));
}
-
-#if TARGET_OS_SIMULATOR
-void CopyTextureData(const MTLSize ®ionSize,
- size_t srcRowPitch,
- size_t src2DImageSize,
- const uint8_t *psrc,
- size_t destRowPitch,
- size_t dest2DImageSize,
- uint8_t *pdst)
-{
- {
- size_t rowCopySize = std::min(srcRowPitch, destRowPitch);
- for (NSUInteger d = 0; d < regionSize.depth; ++d)
- {
- for (NSUInteger r = 0; r < regionSize.height; ++r)
- {
- const uint8_t *pCopySrc = psrc + d * src2DImageSize + r * srcRowPitch;
- uint8_t *pCopyDst = pdst + d * dest2DImageSize + r * destRowPitch;
- memcpy(pCopyDst, pCopySrc, rowCopySize);
- }
- }
- }
-}
-#endif
-
void ConvertDepthStencilData(const MTLSize ®ionSize,
const angle::Format &srcAngleFormat,
size_t srcRowPitch,
@@ -291,39 +266,6 @@
return angle::Result::Continue;
}
-#if TARGET_OS_SIMULATOR
-angle::Result CopyTextureContentsToStagingBuffer(
- ContextMtl *contextMtl,
- const angle::Format &textureAngleFormat,
- const MTLSize ®ionSize,
- const uint8_t *data,
- size_t bytesPerRow,
- size_t bytesPer2DImage,
- size_t *bufferRowPitchOut,
- size_t *buffer2DImageSizeOut,
- mtl::BufferRef *bufferOut)
-{
- size_t stagingBufferRowPitch = regionSize.width * textureAngleFormat.pixelBytes;
- size_t stagingBuffer2DImageSize = stagingBufferRowPitch * regionSize.height;
- size_t stagingBufferSize = stagingBuffer2DImageSize * regionSize.depth;
- mtl::BufferRef stagingBuffer;
- ANGLE_TRY(mtl::Buffer::MakeBuffer(contextMtl, stagingBufferSize, nullptr, &stagingBuffer));
-
- uint8_t *pdst = stagingBuffer->map(contextMtl);
-
- CopyTextureData(regionSize, bytesPerRow, bytesPer2DImage,
- data, stagingBufferRowPitch, stagingBuffer2DImageSize, pdst);
-
- stagingBuffer->unmap(contextMtl);
-
- *bufferOut = stagingBuffer;
- *bufferRowPitchOut = stagingBufferRowPitch;
- *buffer2DImageSizeOut = stagingBuffer2DImageSize;
-
- return angle::Result::Continue;
-}
-#endif
-
angle::Result UploadDepthStencilTextureContentsWithStagingBuffer(
ContextMtl *contextMtl,
const angle::Format &textureAngleFormat,
@@ -436,41 +378,6 @@
return angle::Result::Continue;
}
-#if TARGET_OS_SIMULATOR
-angle::Result UploadTextureContentsWithStagingBuffer(
- ContextMtl *contextMtl,
- const angle::Format &textureAngleFormat,
- MTLRegion region,
- const mtl::MipmapNativeLevel &mipmapLevel,
- uint32_t slice,
- const uint8_t *data,
- size_t bytesPerRow,
- size_t bytesPer2DImage,
- const mtl::TextureRef &texture)
-{
- ASSERT(texture && texture->valid());
-
- angle::FormatID stagingBufferFormatID = textureAngleFormat.id;
- const angle::Format &angleStagingFormat = angle::Format::Get(stagingBufferFormatID);
-
-
- size_t stagingBufferRowPitch;
- size_t stagingBuffer2DImageSize;
- mtl::BufferRef stagingBuffer;
-
- // Copy depth data to staging depth buffer
- ANGLE_TRY(CopyTextureContentsToStagingBuffer(contextMtl, angleStagingFormat, region.size, data, bytesPerRow, bytesPer2DImage, &stagingBufferRowPitch, &stagingBuffer2DImageSize, &stagingBuffer));
- mtl::BlitCommandEncoder *encoder = contextMtl->getBlitCommandEncoder();
-
- encoder->copyBufferToTexture(stagingBuffer, 0, stagingBufferRowPitch,
- stagingBuffer2DImageSize, region.size, texture, slice,
- mipmapLevel, region.origin, 0);
-
-
- return angle::Result::Continue;
-}
-#endif
-
angle::Result UploadTextureContents(const gl::Context *context,
const angle::Format &textureAngleFormat,
const MTLRegion ®ion,
@@ -483,13 +390,7 @@
{
ASSERT(texture && texture->valid());
ContextMtl *contextMtl = mtl::GetImpl(context);
-#if TARGET_OS_SIMULATOR
- if (!textureAngleFormat.depthBits && !textureAngleFormat.stencilBits)
- {
- ANGLE_TRY(UploadTextureContentsWithStagingBuffer(contextMtl,textureAngleFormat,region,mipmapLevel,slice,data,bytesPerRow,bytesPer2DImage,texture));
- return angle::Result::Continue;
- }
-#else
+
if (texture->isCPUAccessible())
{
// If texture is CPU accessible, just call replaceRegion() directly.
@@ -498,7 +399,7 @@
return angle::Result::Continue;
}
-#endif
+
ASSERT(textureAngleFormat.depthBits || textureAngleFormat.stencilBits);
// Texture is not CPU accessible, we need to use staging buffer
@@ -516,7 +417,6 @@
}
return angle::Result::Continue;
-
}
// This might be unused on platform not supporting swizzle.
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm (276506 => 276507)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm 2021-04-23 17:44:03 UTC (rev 276506)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_utils.mm 2021-04-23 18:15:55 UTC (rev 276507)
@@ -113,10 +113,7 @@
const angle::Format &actualAngleFormat = textureObjFormat.actualAngleFormat();
const gl::InternalFormat &intendedInternalFormat = textureObjFormat.intendedInternalFormat();
- bool forceGPUInitialization = false;
-#if TARGET_OS_SIMULATOR
- forceGPUInitialization = true;
-#endif
+
// This function is called in many places to initialize the content of a texture.
// So it's better we do the sanity check here instead of let the callers do it themselves:
if (!textureObjFormat.valid() || actualAngleFormat.isBlock || actualAngleFormat.depthBits > 0 ||
@@ -151,7 +148,7 @@
}
if (texture->isCPUAccessible() && index.getType() != gl::TextureType::_2DMultisample &&
- index.getType() != gl::TextureType::_2DMultisampleArray && forceGPUInitialization == false)
+ index.getType() != gl::TextureType::_2DMultisampleArray)
{
const angle::Format &dstFormat = angle::Format::Get(textureObjFormat.actualFormatId);
const size_t dstRowPitch = dstFormat.pixelBytes * size.width;
@@ -201,7 +198,6 @@
}
}
} // if (texture->isCPUAccessible())
-
else
{
ANGLE_TRY(InitializeTextureContentsGPU(context, texture, textureObjFormat, index,