MTL: Added texture format component mapping from PR #2869.
This commit is contained in:
parent
ec00fa1bc2
commit
b5e7a4cccd
@ -209,108 +209,121 @@ namespace bgfx { namespace mtl
|
||||
|
||||
struct TextureFormatInfo
|
||||
{
|
||||
MTLPixelFormat m_fmt;
|
||||
MTLPixelFormat m_fmtSrgb;
|
||||
MTLReadWriteTextureTier m_rwTier;
|
||||
bool m_autoGetMipmap;
|
||||
MTLPixelFormat m_fmt;
|
||||
MTLPixelFormat m_fmtSrgb;
|
||||
MTLReadWriteTextureTier m_rwTier;
|
||||
MTLTextureSwizzleChannels m_mapping;
|
||||
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
|
||||
#define $0 MTLTextureSwizzleZero
|
||||
#define $1 MTLTextureSwizzleOne
|
||||
#define $R MTLTextureSwizzleRed
|
||||
#define $G MTLTextureSwizzleGreen
|
||||
#define $B MTLTextureSwizzleBlue
|
||||
#define $A MTLTextureSwizzleAlpha
|
||||
{ MTLPixelFormat(130/*BC1_RGBA*/), MTLPixelFormat(131/*BC1_RGBA_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC1
|
||||
{ MTLPixelFormat(132/*BC2_RGBA*/), MTLPixelFormat(133/*BC2_RGBA_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC2
|
||||
{ MTLPixelFormat(134/*BC3_RGBA*/), MTLPixelFormat(135/*BC3_RGBA_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC3
|
||||
{ MTLPixelFormat(140/*BC4_RUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC4
|
||||
{ MTLPixelFormat(142/*BC5_RGUnorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC5
|
||||
{ MTLPixelFormat(150/*BC6H_RGBFloat*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC6H
|
||||
{ MTLPixelFormat(152/*BC7_RGBAUnorm*/), MTLPixelFormat(153/*BC7_RGBAUnorm_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BC7
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ETC1
|
||||
{ MTLPixelFormat(180/*ETC2_RGB8*/), MTLPixelFormat(181/*ETC2_RGB8_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ETC2
|
||||
{ MTLPixelFormat(178/*EAC_RGBA8*/), MTLPixelFormat(179/*EAC_RGBA8_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ETC2A
|
||||
{ MTLPixelFormat(182/*ETC2_RGB8A1*/), MTLPixelFormat(183/*ETC2_RGB8A1_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ETC2A1
|
||||
{ MTLPixelFormat(160/*PVRTC_RGB_2BPP*/), MTLPixelFormat(161/*PVRTC_RGB_2BPP_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC12
|
||||
{ MTLPixelFormat(162/*PVRTC_RGB_4BPP*/), MTLPixelFormat(163/*PVRTC_RGB_4BPP_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC14
|
||||
{ MTLPixelFormat(164/*PVRTC_RGBA_2BPP*/), MTLPixelFormat(165/*PVRTC_RGBA_2BPP_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC12A
|
||||
{ MTLPixelFormat(166/*PVRTC_RGBA_4BPP*/), MTLPixelFormat(167/*PVRTC_RGBA_4BPP_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC14A
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC22
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // PTC24
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ATC
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ATCE
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, 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, { $R, $G, $B, $A }, false }, // ASTC4x4
|
||||
{ MTLPixelFormatASTC_5x5_LDR, MTLPixelFormatASTC_5x5_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC5x5
|
||||
{ MTLPixelFormatASTC_6x6_LDR, MTLPixelFormatASTC_6x6_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC6x6
|
||||
{ MTLPixelFormatASTC_8x5_LDR, MTLPixelFormatASTC_8x5_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC8x5
|
||||
{ MTLPixelFormatASTC_8x6_LDR, MTLPixelFormatASTC_8x6_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC8x6
|
||||
{ MTLPixelFormatASTC_10x5_LDR, MTLPixelFormatASTC_10x5_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, 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, { $R, $G, $B, $A }, false }, // ASTC4x4
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC5x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC6x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC8x5
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // ASTC8x6
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, 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, { $R, $G, $B, $A }, false }, // Unknown
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // R1
|
||||
{ MTLPixelFormatA8Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // A8
|
||||
{ MTLPixelFormatR8Unorm, MTLPixelFormat(11/*R8Unorm_sRGB*/), MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // R8
|
||||
{ MTLPixelFormatR8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // R8I
|
||||
{ MTLPixelFormatR8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // R8U
|
||||
{ MTLPixelFormatR8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // R8S
|
||||
{ MTLPixelFormatR16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // R16
|
||||
{ MTLPixelFormatR16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // R16I
|
||||
{ MTLPixelFormatR16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // R16U
|
||||
{ MTLPixelFormatR16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // R16F
|
||||
{ MTLPixelFormatR16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // R16S
|
||||
{ MTLPixelFormatR32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, { $R, $G, $B, $A }, false }, // R32I
|
||||
{ MTLPixelFormatR32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, { $R, $G, $B, $A }, false }, // R32U
|
||||
{ MTLPixelFormatR32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier1, { $R, $G, $B, $A }, false }, // R32F
|
||||
{ MTLPixelFormatRG8Unorm, MTLPixelFormat(31/*RG8Unorm_sRGB*/), MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG8
|
||||
{ MTLPixelFormatRG8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG8I
|
||||
{ MTLPixelFormatRG8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG8U
|
||||
{ MTLPixelFormatRG8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG8S
|
||||
{ MTLPixelFormatRG16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG16
|
||||
{ MTLPixelFormatRG16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG16I
|
||||
{ MTLPixelFormatRG16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG16U
|
||||
{ MTLPixelFormatRG16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG16F
|
||||
{ MTLPixelFormatRG16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG16S
|
||||
{ MTLPixelFormatRG32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG32I
|
||||
{ MTLPixelFormatRG32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG32U
|
||||
{ MTLPixelFormatRG32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RG32F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RGB8
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RGB8I
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RGB8U
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RGB8S
|
||||
{ MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // RGB9E5F
|
||||
{ MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // BGRA8
|
||||
{ MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // RGBA8
|
||||
{ MTLPixelFormatRGBA8Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // RGBA8I
|
||||
{ MTLPixelFormatRGBA8Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // RGBA8U
|
||||
{ MTLPixelFormatRGBA8Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGBA8S
|
||||
{ MTLPixelFormatRGBA16Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGBA16
|
||||
{ MTLPixelFormatRGBA16Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // RGBA16I
|
||||
{ MTLPixelFormatRGBA16Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, false }, // RGBA16U
|
||||
{ MTLPixelFormatRGBA16Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // RGBA16F
|
||||
{ MTLPixelFormatRGBA16Snorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGBA16S
|
||||
{ MTLPixelFormatRGBA32Sint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // RGBA32I
|
||||
{ MTLPixelFormatRGBA32Uint, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // RGBA32U
|
||||
{ MTLPixelFormatRGBA32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTier2, { $R, $G, $B, $A }, true }, // RGBA32F
|
||||
{ MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // R5G6B5
|
||||
{ MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGBA4
|
||||
{ MTLPixelFormat(41/*A1BGR5Unorm*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGB5A1
|
||||
{ MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RGB10A2
|
||||
{ MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, true }, // RG11B10F
|
||||
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // UnknownDepth
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D16
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D24
|
||||
{ MTLPixelFormat(255/*Depth24Unorm_Stencil8*/), MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D24S8
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D32
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D16F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D24F
|
||||
{ MTLPixelFormatDepth32Float, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D32F
|
||||
{ MTLPixelFormatStencil8, MTLPixelFormatInvalid, MTLReadWriteTextureTierNone, { $R, $G, $B, $A }, false }, // D0S8
|
||||
#undef $0
|
||||
#undef $1
|
||||
#undef $R
|
||||
#undef $G
|
||||
#undef $B
|
||||
#undef $A
|
||||
};
|
||||
BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
|
||||
|
||||
@ -2863,10 +2876,12 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
||||
const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
|
||||
const int32_t sampleCount = s_msaa[msaaQuality];
|
||||
|
||||
const TextureFormatInfo& tfi = s_textureFormat[m_textureFormat];
|
||||
|
||||
MTLPixelFormat format = MTLPixelFormatInvalid;
|
||||
if (srgb)
|
||||
{
|
||||
format = s_textureFormat[m_textureFormat].m_fmtSrgb;
|
||||
format = tfi.m_fmtSrgb;
|
||||
BX_WARN(format != MTLPixelFormatInvalid
|
||||
, "sRGB not supported for texture format %d"
|
||||
, m_textureFormat
|
||||
@ -2876,7 +2891,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
||||
if (format == MTLPixelFormatInvalid)
|
||||
{
|
||||
// not swizzled and not sRGB, or sRGB unsupported
|
||||
format = s_textureFormat[m_textureFormat].m_fmt;
|
||||
format = tfi.m_fmt;
|
||||
}
|
||||
|
||||
desc.pixelFormat = format;
|
||||
@ -2886,6 +2901,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
||||
desc.mipmapLevelCount = ti.numMips;
|
||||
desc.sampleCount = 1;
|
||||
desc.arrayLength = ti.numLayers;
|
||||
desc.swizzle = tfi.m_mapping;
|
||||
|
||||
if (s_renderMtl->m_iOS9Runtime
|
||||
|| s_renderMtl->m_macOS11Runtime)
|
||||
|
Loading…
Reference in New Issue
Block a user