From edcb2f0b8216f964f10ba60d96b8070fdc1ae257 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:22:43 -0600 Subject: Add implementation for 'uploadTextureData' in metal (#6443) Close issue: #6386. - Implement uploadTextureData in metal - Fix a bug in 'copyTextureToBuffer' in metal The last parameter for Metal::copyFromTexture is the 'destinationBytesPerImage', but previous implementation fill in the destination size which is wrong in 3-D texture. --- tools/gfx/metal/metal-device.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/gfx/metal/metal-device.cpp') diff --git a/tools/gfx/metal/metal-device.cpp b/tools/gfx/metal/metal-device.cpp index 34b00d0dd..90904e0e2 100644 --- a/tools/gfx/metal/metal-device.cpp +++ b/tools/gfx/metal/metal-device.cpp @@ -331,7 +331,9 @@ Result DeviceImpl::getTextureAllocationInfo( FormatInfo formatInfo; gfxGetFormatInfo(desc.format, &formatInfo); MTL::PixelFormat pixelFormat = MetalUtil::translatePixelFormat(desc.format); - Size alignment = m_device->minimumLinearTextureAlignmentForPixelFormat(pixelFormat); + bool isCompressed = gfxIsCompressedFormat(desc.format); + Size alignment = + isCompressed ? 1 : m_device->minimumLinearTextureAlignmentForPixelFormat(pixelFormat); Size size = 0; ITextureResource::Extents extents = desc.size; extents.width = extents.width ? extents.width : 1; -- cgit v1.2.3