metal use MTLPixelFormatDepth16Unorm for D16 format (#3246)

This commit is contained in:
Kitchen 2024-02-01 23:06:10 +08:00 committed by GitHub
parent 899a64122d
commit d9e184501f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -329,7 +329,7 @@ namespace bgfx { namespace mtl
{ 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
{ MTLPixelFormatDepth16Unorm, 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
@ -687,6 +687,10 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
: 0
;
if (!(iOSVersionEqualOrGreater("13.0.0") || macOSVersionEqualOrGreater(12, 0, 0))){
s_textureFormat[TextureFormat::D16].m_fmt = MTLPixelFormatDepth32Float;
}
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
{
uint16_t support = 0;