mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
VideoBackends:Metal: Enable BCn support on iOS
This commit is contained in:
parent
3ec9b56e73
commit
9cc3ba6fc6
@ -193,20 +193,18 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
|
|||||||
config->backend_info.bSupportsST3CTextures = true;
|
config->backend_info.bSupportsST3CTextures = true;
|
||||||
config->backend_info.bSupportsBPTCTextures = true;
|
config->backend_info.bSupportsBPTCTextures = true;
|
||||||
#else
|
#else
|
||||||
bool supports_mac1 = false;
|
|
||||||
bool supports_apple4 = false;
|
bool supports_apple4 = false;
|
||||||
|
bool supports_bcn = false;
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
{
|
|
||||||
supports_mac1 = [device supportsFamily:MTLGPUFamilyMac1];
|
|
||||||
supports_apple4 = [device supportsFamily:MTLGPUFamilyApple4];
|
supports_apple4 = [device supportsFamily:MTLGPUFamilyApple4];
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
supports_apple4 = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1];
|
supports_apple4 = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1];
|
||||||
}
|
if (@available(iOS 16.4, *))
|
||||||
config->backend_info.bSupportsDepthClamp = supports_mac1 || supports_apple4;
|
supports_bcn = [device supportsBCTextureCompression];
|
||||||
config->backend_info.bSupportsST3CTextures = supports_mac1;
|
config->backend_info.bSupportsDepthClamp = supports_apple4;
|
||||||
config->backend_info.bSupportsBPTCTextures = supports_mac1;
|
config->backend_info.bSupportsST3CTextures = supports_bcn;
|
||||||
|
config->backend_info.bSupportsBPTCTextures = supports_bcn;
|
||||||
|
|
||||||
config->backend_info.bSupportsFramebufferFetch = true;
|
config->backend_info.bSupportsFramebufferFetch = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -265,12 +263,10 @@ AbstractTextureFormat Metal::Util::ToAbstract(MTLPixelFormat format)
|
|||||||
{
|
{
|
||||||
case MTLPixelFormatRGBA8Unorm: return AbstractTextureFormat::RGBA8;
|
case MTLPixelFormatRGBA8Unorm: return AbstractTextureFormat::RGBA8;
|
||||||
case MTLPixelFormatBGRA8Unorm: return AbstractTextureFormat::BGRA8;
|
case MTLPixelFormatBGRA8Unorm: return AbstractTextureFormat::BGRA8;
|
||||||
#if TARGET_OS_OSX
|
|
||||||
case MTLPixelFormatBC1_RGBA: return AbstractTextureFormat::DXT1;
|
case MTLPixelFormatBC1_RGBA: return AbstractTextureFormat::DXT1;
|
||||||
case MTLPixelFormatBC2_RGBA: return AbstractTextureFormat::DXT3;
|
case MTLPixelFormatBC2_RGBA: return AbstractTextureFormat::DXT3;
|
||||||
case MTLPixelFormatBC3_RGBA: return AbstractTextureFormat::DXT5;
|
case MTLPixelFormatBC3_RGBA: return AbstractTextureFormat::DXT5;
|
||||||
case MTLPixelFormatBC7_RGBAUnorm: return AbstractTextureFormat::BPTC;
|
case MTLPixelFormatBC7_RGBAUnorm: return AbstractTextureFormat::BPTC;
|
||||||
#endif
|
|
||||||
case MTLPixelFormatR16Unorm: return AbstractTextureFormat::R16;
|
case MTLPixelFormatR16Unorm: return AbstractTextureFormat::R16;
|
||||||
case MTLPixelFormatDepth16Unorm: return AbstractTextureFormat::D16;
|
case MTLPixelFormatDepth16Unorm: return AbstractTextureFormat::D16;
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
@ -283,18 +279,20 @@ AbstractTextureFormat Metal::Util::ToAbstract(MTLPixelFormat format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't complain about BCn formats requiring iOS 16.4, these are just enum conversions
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||||
|
|
||||||
MTLPixelFormat Metal::Util::FromAbstract(AbstractTextureFormat format)
|
MTLPixelFormat Metal::Util::FromAbstract(AbstractTextureFormat format)
|
||||||
{
|
{
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case AbstractTextureFormat::RGBA8: return MTLPixelFormatRGBA8Unorm;
|
case AbstractTextureFormat::RGBA8: return MTLPixelFormatRGBA8Unorm;
|
||||||
case AbstractTextureFormat::BGRA8: return MTLPixelFormatBGRA8Unorm;
|
case AbstractTextureFormat::BGRA8: return MTLPixelFormatBGRA8Unorm;
|
||||||
#if TARGET_OS_OSX
|
|
||||||
case AbstractTextureFormat::DXT1: return MTLPixelFormatBC1_RGBA;
|
case AbstractTextureFormat::DXT1: return MTLPixelFormatBC1_RGBA;
|
||||||
case AbstractTextureFormat::DXT3: return MTLPixelFormatBC2_RGBA;
|
case AbstractTextureFormat::DXT3: return MTLPixelFormatBC2_RGBA;
|
||||||
case AbstractTextureFormat::DXT5: return MTLPixelFormatBC3_RGBA;
|
case AbstractTextureFormat::DXT5: return MTLPixelFormatBC3_RGBA;
|
||||||
case AbstractTextureFormat::BPTC: return MTLPixelFormatBC7_RGBAUnorm;
|
case AbstractTextureFormat::BPTC: return MTLPixelFormatBC7_RGBAUnorm;
|
||||||
#endif
|
|
||||||
case AbstractTextureFormat::R16: return MTLPixelFormatR16Unorm;
|
case AbstractTextureFormat::R16: return MTLPixelFormatR16Unorm;
|
||||||
case AbstractTextureFormat::D16: return MTLPixelFormatDepth16Unorm;
|
case AbstractTextureFormat::D16: return MTLPixelFormatDepth16Unorm;
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
@ -307,6 +305,8 @@ MTLPixelFormat Metal::Util::FromAbstract(AbstractTextureFormat format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// MARK: Shader Translation
|
// MARK: Shader Translation
|
||||||
|
Loading…
Reference in New Issue
Block a user