From 7872bb1b97f347c73b0125dba02c649f2b4bdf7e Mon Sep 17 00:00:00 2001 From: halx99 Date: Mon, 31 Aug 2020 15:45:05 +0800 Subject: [PATCH] ETC2 Metal support --- cocos/renderer/backend/metal/TextureMTL.mm | 2 +- cocos/renderer/backend/metal/Utils.mm | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/renderer/backend/metal/TextureMTL.mm b/cocos/renderer/backend/metal/TextureMTL.mm index d4df762a38..1aa9fb4ebe 100644 --- a/cocos/renderer/backend/metal/TextureMTL.mm +++ b/cocos/renderer/backend/metal/TextureMTL.mm @@ -199,7 +199,7 @@ namespace { bytesPerRow = 0; } - else if (textureFormat == PixelFormat::ETC) + else if (textureFormat == PixelFormat::ETC || textureFormat == PixelFormat::ETC2_RGBA || textureFormat == PixelFormat::ETC2_RGB) { bytesPerRow = getBytesPerRowETC(pixelFormat, width); } diff --git a/cocos/renderer/backend/metal/Utils.mm b/cocos/renderer/backend/metal/Utils.mm index eb49aa25da..3e44df3105 100644 --- a/cocos/renderer/backend/metal/Utils.mm +++ b/cocos/renderer/backend/metal/Utils.mm @@ -122,7 +122,10 @@ MTLPixelFormat Utils::toMTLPixelFormat(PixelFormat textureFormat) case PixelFormat::PVRTC2: return MTLPixelFormatPVRTC_RGB_2BPP; case PixelFormat::ETC: + case PixelFormat::ETC2_RGB: return MTLPixelFormatETC2_RGB8; + case PixelFormat::ETC2_RGBA: + return MTLPixelFormatEAC_RGBA8; case PixelFormat::ASTC4: return MTLPixelFormatASTC_4x4_LDR; case PixelFormat::ASTC8: