summaryrefslogtreecommitdiff
path: root/tools/gfx/metal/metal-device.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-02-24 13:22:43 -0600
committerGitHub <noreply@github.com>2025-02-24 11:22:43 -0800
commitedcb2f0b8216f964f10ba60d96b8070fdc1ae257 (patch)
treeb12a67a15fa4c520f8e5b60cc405264019c83538 /tools/gfx/metal/metal-device.cpp
parent4e897189e301e44cba71906e6c5e561b7cd07a62 (diff)
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.
Diffstat (limited to 'tools/gfx/metal/metal-device.cpp')
-rw-r--r--tools/gfx/metal/metal-device.cpp4
1 files changed, 3 insertions, 1 deletions
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;