mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-18 18:42:40 +00:00
Remove superfluous availability checks
This commit is contained in:
parent
77d07c7c4d
commit
8302187dee
@ -336,89 +336,56 @@ public:
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||||
// Prior to 10.13, we'll just assume everything has
|
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_H264)) {
|
||||||
// H.264 support and fail open to allow VT decode.
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
|
|
||||||
if (__builtin_available(macOS 10.13, *)) {
|
|
||||||
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_H264)) {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"No HW accelerated H.264 decode via VT");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Assuming H.264 HW decode on < macOS 10.13");
|
"No HW accelerated H.264 decode via VT");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (params->videoFormat & VIDEO_FORMAT_MASK_H265) {
|
else if (params->videoFormat & VIDEO_FORMAT_MASK_H265) {
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
|
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
|
||||||
if (__builtin_available(macOS 10.13, *)) {
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
|
"No HW accelerated HEVC decode via VT");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HEVC Main10 requires more extensive checks because there's no
|
||||||
|
// simple API to check for Main10 hardware decoding, and if we don't
|
||||||
|
// have it, we'll silently get software decoding with horrible performance.
|
||||||
|
if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||||
|
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
||||||
|
if (device == nullptr) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"No HW accelerated HEVC decode via VT");
|
"Unable to get default Metal device");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HEVC Main10 requires more extensive checks because there's no
|
// Exclude all GPUs earlier than macOSGPUFamily2
|
||||||
// simple API to check for Main10 hardware decoding, and if we don't
|
// https://developer.apple.com/documentation/metal/mtlfeatureset/mtlfeatureset_macos_gpufamily2_v1
|
||||||
// have it, we'll silently get software decoding with horrible performance.
|
if ([device supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily2_v1]) {
|
||||||
if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
if ([device.name containsString:@"Intel"]) {
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
|
// 500-series Intel GPUs are Skylake and don't support Main10 hardware decoding
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
if ([device.name containsString:@" 5"]) {
|
||||||
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
|
||||||
if (device == nullptr) {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Unable to get default Metal device");
|
"No HEVC Main10 support on Skylake iGPU");
|
||||||
|
[device release];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exclude all GPUs earlier than macOSGPUFamily2
|
|
||||||
// https://developer.apple.com/documentation/metal/mtlfeatureset/mtlfeatureset_macos_gpufamily2_v1
|
|
||||||
if ([device supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily2_v1]) {
|
|
||||||
if ([device.name containsString:@"Intel"]) {
|
|
||||||
// 500-series Intel GPUs are Skylake and don't support Main10 hardware decoding
|
|
||||||
if ([device.name containsString:@" 5"]) {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"No HEVC Main10 support on Skylake iGPU");
|
|
||||||
[device release];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ([device.name containsString:@"AMD"]) {
|
|
||||||
// FirePro D, M200, and M300 series GPUs don't support Main10 hardware decoding
|
|
||||||
if ([device.name containsString:@"FirePro D"] ||
|
|
||||||
[device.name containsString:@" M2"] ||
|
|
||||||
[device.name containsString:@" M3"]) {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"No HEVC Main10 support on AMD GPUs until Polaris");
|
|
||||||
[device release];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[device release];
|
|
||||||
}
|
}
|
||||||
else
|
else if ([device.name containsString:@"AMD"]) {
|
||||||
#endif
|
// FirePro D, M200, and M300 series GPUs don't support Main10 hardware decoding
|
||||||
{
|
if ([device.name containsString:@"FirePro D"] ||
|
||||||
// Fail closed for HEVC Main10 if we're not on 10.14+
|
[device.name containsString:@" M2"] ||
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
[device.name containsString:@" M3"]) {
|
||||||
"No HEVC Main10 support on < macOS 10.14");
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
return false;
|
"No HEVC Main10 support on AMD GPUs until Polaris");
|
||||||
|
[device release];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
[device release];
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Fail closed for HEVC if we're not on 10.13+
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"No HEVC support on < macOS 10.13");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user