Cleanup.
This commit is contained in:
parent
35c27cda3d
commit
b8fdc3f8be
@ -209,115 +209,108 @@ namespace bgfx { namespace mtl
|
||||
|
||||
struct TextureFormatInfo
|
||||
{
|
||||
MTLPixelFormat m_fmt;
|
||||
MTLPixelFormat m_fmtSrgb;
|
||||
|
||||
// see: https://developer.apple.com/documentation/metal/mtlreadwritetexturetier?language=objc
|
||||
MTLPixelFormat m_fmt;
|
||||
MTLPixelFormat m_fmtSrgb;
|
||||
MTLReadWriteTextureTier m_rwTier;
|
||||
// https://web.archive.org/web/20220425141554/https://developer.apple.com/documentation/metal/mtlblitcommandencoder/1400748-generatemipmapsfortexture
|
||||
//
|
||||
// Mipmap generation works only for textures with color-renderable and color-filterable pixel formats.
|
||||
//
|
||||
// Page 6: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
|
||||
bool m_autoGetMipmap;
|
||||
bool m_autoGetMipmap;
|
||||
};
|
||||
|
||||
static TextureFormatInfo s_textureFormat[] =
|
||||
{
|
||||
{ MTLPixelFormat(130/*BC1_RGBA*/), MTLPixelFormat(131/*BC1_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false}, // BC1
|
||||
{ MTLPixelFormat(132/*BC2_RGBA*/), MTLPixelFormat(133/*BC2_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false}, // BC2
|
||||
{ MTLPixelFormat(134/*BC3_RGBA*/), MTLPixelFormat(135/*BC3_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false}, // BC3
|
||||
{ MTLPixelFormat(140/*BC4_RUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // BC4
|
||||
{ MTLPixelFormat(142/*BC5_RGUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // BC5
|
||||
{ MTLPixelFormat(150/*BC6H_RGBFloat*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // BC6H
|
||||
{ MTLPixelFormat(152/*BC7_RGBAUnorm*/), MTLPixelFormat(153/*BC7_RGBAUnorm_sRGB*/), MTLReadWriteTextureTierNone, false}, // BC7
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ETC1
|
||||
{ MTLPixelFormat(180/*ETC2_RGB8*/), MTLPixelFormat(181/*ETC2_RGB8_sRGB*/), MTLReadWriteTextureTierNone, false}, // ETC2
|
||||
{ MTLPixelFormat(178/*EAC_RGBA8*/), MTLPixelFormat(179/*EAC_RGBA8_sRGB*/), MTLReadWriteTextureTierNone, false}, // ETC2A
|
||||
{ MTLPixelFormat(182/*ETC2_RGB8A1*/), MTLPixelFormat(183/*ETC2_RGB8A1_sRGB*/), MTLReadWriteTextureTierNone, false}, // ETC2A1
|
||||
{ MTLPixelFormat(160/*PVRTC_RGB_2BPP*/), MTLPixelFormat(161/*PVRTC_RGB_2BPP_sRGB*/), MTLReadWriteTextureTierNone, false}, // PTC12
|
||||
{ MTLPixelFormat(162/*PVRTC_RGB_4BPP*/), MTLPixelFormat(163/*PVRTC_RGB_4BPP_sRGB*/), MTLReadWriteTextureTierNone, false}, // PTC14
|
||||
{ MTLPixelFormat(164/*PVRTC_RGBA_2BPP*/), MTLPixelFormat(165/*PVRTC_RGBA_2BPP_sRGB*/),MTLReadWriteTextureTierNone, false}, // PTC12A
|
||||
{ MTLPixelFormat(166/*PVRTC_RGBA_4BPP*/), MTLPixelFormat(167/*PVRTC_RGBA_4BPP_sRGB*/),MTLReadWriteTextureTierNone, false}, // PTC14A
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // PTC22
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // PTC24
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ATC
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ATCE
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ATCI
|
||||
{ MTLPixelFormat(130/*BC1_RGBA*/), MTLPixelFormat(131/*BC1_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false }, // BC1
|
||||
{ MTLPixelFormat(132/*BC2_RGBA*/), MTLPixelFormat(133/*BC2_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false }, // BC2
|
||||
{ MTLPixelFormat(134/*BC3_RGBA*/), MTLPixelFormat(135/*BC3_RGBA_sRGB*/), MTLReadWriteTextureTierNone, false }, // BC3
|
||||
{ MTLPixelFormat(140/*BC4_RUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // BC4
|
||||
{ MTLPixelFormat(142/*BC5_RGUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // BC5
|
||||
{ MTLPixelFormat(150/*BC6H_RGBFloat*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // BC6H
|
||||
{ MTLPixelFormat(152/*BC7_RGBAUnorm*/), MTLPixelFormat(153/*BC7_RGBAUnorm_sRGB*/), MTLReadWriteTextureTierNone, false }, // BC7
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ETC1
|
||||
{ MTLPixelFormat(180/*ETC2_RGB8*/), MTLPixelFormat(181/*ETC2_RGB8_sRGB*/), MTLReadWriteTextureTierNone, false }, // ETC2
|
||||
{ MTLPixelFormat(178/*EAC_RGBA8*/), MTLPixelFormat(179/*EAC_RGBA8_sRGB*/), MTLReadWriteTextureTierNone, false }, // ETC2A
|
||||
{ MTLPixelFormat(182/*ETC2_RGB8A1*/), MTLPixelFormat(183/*ETC2_RGB8A1_sRGB*/), MTLReadWriteTextureTierNone, false }, // ETC2A1
|
||||
{ MTLPixelFormat(160/*PVRTC_RGB_2BPP*/), MTLPixelFormat(161/*PVRTC_RGB_2BPP_sRGB*/), MTLReadWriteTextureTierNone, false }, // PTC12
|
||||
{ MTLPixelFormat(162/*PVRTC_RGB_4BPP*/), MTLPixelFormat(163/*PVRTC_RGB_4BPP_sRGB*/), MTLReadWriteTextureTierNone, false }, // PTC14
|
||||
{ MTLPixelFormat(164/*PVRTC_RGBA_2BPP*/), MTLPixelFormat(165/*PVRTC_RGBA_2BPP_sRGB*/), MTLReadWriteTextureTierNone, false }, // PTC12A
|
||||
{ MTLPixelFormat(166/*PVRTC_RGBA_4BPP*/), MTLPixelFormat(167/*PVRTC_RGBA_4BPP_sRGB*/), MTLReadWriteTextureTierNone, false }, // PTC14A
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // PTC22
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // PTC24
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ATC
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ATCE
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ATCI
|
||||
#if BX_PLATFORM_IOS && !TARGET_OS_MACCATALYST
|
||||
{ MTLPixelFormatASTC_4x4_LDR, MTLPixelFormatASTC_4x4_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC4x4
|
||||
{ MTLPixelFormatASTC_5x5_LDR, MTLPixelFormatASTC_5x5_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC5x5
|
||||
{ MTLPixelFormatASTC_6x6_LDR, MTLPixelFormatASTC_6x6_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC6x6
|
||||
{ MTLPixelFormatASTC_8x5_LDR, MTLPixelFormatASTC_8x5_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC8x5
|
||||
{ MTLPixelFormatASTC_8x6_LDR, MTLPixelFormatASTC_8x6_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC8x6
|
||||
{ MTLPixelFormatASTC_10x5_LDR, MTLPixelFormatASTC_10x5_sRGB, MTLReadWriteTextureTierNone, false}, // ASTC10x5
|
||||
{ MTLPixelFormatASTC_4x4_LDR, MTLPixelFormatASTC_4x4_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC4x4
|
||||
{ MTLPixelFormatASTC_5x5_LDR, MTLPixelFormatASTC_5x5_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC5x5
|
||||
{ MTLPixelFormatASTC_6x6_LDR, MTLPixelFormatASTC_6x6_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC6x6
|
||||
{ MTLPixelFormatASTC_8x5_LDR, MTLPixelFormatASTC_8x5_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC8x5
|
||||
{ MTLPixelFormatASTC_8x6_LDR, MTLPixelFormatASTC_8x6_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC8x6
|
||||
{ MTLPixelFormatASTC_10x5_LDR, MTLPixelFormatASTC_10x5_sRGB, MTLReadWriteTextureTierNone, false }, // ASTC10x5
|
||||
#else
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC4x4
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC5x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC6x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC8x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC8x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // ASTC10x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC4x4
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC5x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC6x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC8x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC8x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // ASTC10x5
|
||||
#endif // BX_PLATFORM_IOS && !TARGET_OS_MACCATALYST
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // Unknown
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // R1
|
||||
{ MTLPixelFormatA8Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // A8
|
||||
{ MTLPixelFormatR8Unorm, MTLPixelFormat(11/*R8Unorm_sRGB*/), MTLReadWriteTextureTier2, true }, // R8
|
||||
{ MTLPixelFormatR8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // R8I
|
||||
{ MTLPixelFormatR8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // R8U
|
||||
{ MTLPixelFormatR8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // R8S
|
||||
{ MTLPixelFormatR16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R16
|
||||
{ MTLPixelFormatR16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // R16I
|
||||
{ MTLPixelFormatR16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // R16U
|
||||
{ MTLPixelFormatR16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // R16F
|
||||
{ MTLPixelFormatR16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R16S
|
||||
{ MTLPixelFormatR32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false}, // R32I
|
||||
{ MTLPixelFormatR32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false}, // R32U
|
||||
{ MTLPixelFormatR32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false}, // R32F
|
||||
{ MTLPixelFormatRG8Unorm, MTLPixelFormat(31/*RG8Unorm_sRGB*/), MTLReadWriteTextureTierNone, true }, // RG8
|
||||
{ MTLPixelFormatRG8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG8I
|
||||
{ MTLPixelFormatRG8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG8U
|
||||
{ MTLPixelFormatRG8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG8S
|
||||
{ MTLPixelFormatRG16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16
|
||||
{ MTLPixelFormatRG16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG16I
|
||||
{ MTLPixelFormatRG16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG16U
|
||||
{ MTLPixelFormatRG16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16F
|
||||
{ MTLPixelFormatRG16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16S
|
||||
{ MTLPixelFormatRG32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG32I
|
||||
{ MTLPixelFormatRG32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG32U
|
||||
{ MTLPixelFormatRG32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RG32F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RGB8
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RGB8I
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RGB8U
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RGB8S
|
||||
{ MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // RGB9E5F
|
||||
{ MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB, MTLReadWriteTextureTierNone, false}, // BGRA8
|
||||
{ MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB, MTLReadWriteTextureTier2, true }, // RGBA8
|
||||
{ MTLPixelFormatRGBA8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // RGBA8I
|
||||
{ MTLPixelFormatRGBA8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // RGBA8U
|
||||
{ MTLPixelFormatRGBA8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA8S
|
||||
{ MTLPixelFormatRGBA16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA16
|
||||
{ MTLPixelFormatRGBA16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // RGBA16I
|
||||
{ MTLPixelFormatRGBA16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false}, // RGBA16U
|
||||
{ MTLPixelFormatRGBA16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA16F
|
||||
{ MTLPixelFormatRGBA16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA16S
|
||||
{ MTLPixelFormatRGBA32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32I
|
||||
{ MTLPixelFormatRGBA32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32U
|
||||
{ MTLPixelFormatRGBA32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32F
|
||||
{ MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R5G6B5
|
||||
{ MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA4
|
||||
{ MTLPixelFormat(41/*A1BGR5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGB5A1
|
||||
{ MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGB10A2
|
||||
{ MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG11B10F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // UnknownDepth
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D16
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D24
|
||||
{ MTLPixelFormat(255/*Depth24Unorm_Stencil8*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D24S8
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D32
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D16F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D24F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D32F
|
||||
{ MTLPixelFormatStencil8, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false}, // D0S8
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // Unknown
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // R1
|
||||
{ MTLPixelFormatA8Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // A8
|
||||
{ MTLPixelFormatR8Unorm, MTLPixelFormat(11/*R8Unorm_sRGB*/), MTLReadWriteTextureTier2, true }, // R8
|
||||
{ MTLPixelFormatR8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // R8I
|
||||
{ MTLPixelFormatR8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // R8U
|
||||
{ MTLPixelFormatR8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // R8S
|
||||
{ MTLPixelFormatR16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R16
|
||||
{ MTLPixelFormatR16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // R16I
|
||||
{ MTLPixelFormatR16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // R16U
|
||||
{ MTLPixelFormatR16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // R16F
|
||||
{ MTLPixelFormatR16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R16S
|
||||
{ MTLPixelFormatR32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false }, // R32I
|
||||
{ MTLPixelFormatR32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false }, // R32U
|
||||
{ MTLPixelFormatR32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, false }, // R32F
|
||||
{ MTLPixelFormatRG8Unorm, MTLPixelFormat(31/*RG8Unorm_sRGB*/), MTLReadWriteTextureTierNone, true }, // RG8
|
||||
{ MTLPixelFormatRG8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG8I
|
||||
{ MTLPixelFormatRG8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG8U
|
||||
{ MTLPixelFormatRG8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG8S
|
||||
{ MTLPixelFormatRG16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16
|
||||
{ MTLPixelFormatRG16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG16I
|
||||
{ MTLPixelFormatRG16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG16U
|
||||
{ MTLPixelFormatRG16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16F
|
||||
{ MTLPixelFormatRG16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG16S
|
||||
{ MTLPixelFormatRG32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG32I
|
||||
{ MTLPixelFormatRG32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG32U
|
||||
{ MTLPixelFormatRG32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RG32F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RGB8
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RGB8I
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RGB8U
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RGB8S
|
||||
{ MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // RGB9E5F
|
||||
{ MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB, MTLReadWriteTextureTierNone, false }, // BGRA8
|
||||
{ MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB, MTLReadWriteTextureTier2, true }, // RGBA8
|
||||
{ MTLPixelFormatRGBA8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // RGBA8I
|
||||
{ MTLPixelFormatRGBA8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // RGBA8U
|
||||
{ MTLPixelFormatRGBA8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA8S
|
||||
{ MTLPixelFormatRGBA16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA16
|
||||
{ MTLPixelFormatRGBA16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // RGBA16I
|
||||
{ MTLPixelFormatRGBA16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, false }, // RGBA16U
|
||||
{ MTLPixelFormatRGBA16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA16F
|
||||
{ MTLPixelFormatRGBA16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA16S
|
||||
{ MTLPixelFormatRGBA32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32I
|
||||
{ MTLPixelFormatRGBA32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32U
|
||||
{ MTLPixelFormatRGBA32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, true }, // RGBA32F
|
||||
{ MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // R5G6B5
|
||||
{ MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGBA4
|
||||
{ MTLPixelFormat(41/*A1BGR5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGB5A1
|
||||
{ MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RGB10A2
|
||||
{ MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, true }, // RG11B10F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // UnknownDepth
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D16
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D24
|
||||
{ MTLPixelFormat(255/*Depth24Unorm_Stencil8*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D24S8
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D32
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D16F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D24F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D32F
|
||||
{ MTLPixelFormatStencil8, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, false }, // D0S8
|
||||
};
|
||||
BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
|
||||
|
||||
@ -673,9 +666,11 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
||||
}
|
||||
|
||||
const MTLReadWriteTextureTier rwTier = [m_device readWriteTextureSupport];
|
||||
g_caps.supported |= rwTier != MTLReadWriteTextureTierNone
|
||||
? BGFX_CAPS_IMAGE_RW
|
||||
: 0;
|
||||
g_caps.supported |= rwTier != MTLReadWriteTextureTierNone
|
||||
? BGFX_CAPS_IMAGE_RW
|
||||
: 0
|
||||
;
|
||||
|
||||
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
||||
{
|
||||
uint16_t support = 0;
|
||||
@ -704,12 +699,14 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
support |= (s_textureFormat[ii].m_rwTier != MTLReadWriteTextureTierNone
|
||||
&& rwTier >= s_textureFormat[ii].m_rwTier)
|
||||
support |= true
|
||||
&& s_textureFormat[ii].m_rwTier != MTLReadWriteTextureTierNone
|
||||
&& s_textureFormat[ii].m_rwTier <= rwTier
|
||||
? BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ
|
||||
| BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE
|
||||
: BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||
: BGFX_CAPS_FORMAT_TEXTURE_NONE
|
||||
;
|
||||
|
||||
support |= s_textureFormat[ii].m_autoGetMipmap
|
||||
? BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN
|
||||
: 0
|
||||
|
Loading…
Reference in New Issue
Block a user