summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-06-11 18:39:24 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-07-21 20:44:19 -0500
commita5ef9dfd5316f8db28f9da16710eeeed9ab1e19e (patch)
treec9d72003880fd9d36cf7456c078d55f0796491d5 /Source
parent716c0980d7424dffafe222c5579851b11193301a (diff)
VideoBackends:Metal: Use DriverDetails for bugs
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoBackends/Metal/MTLUtil.mm23
-rw-r--r--Source/Core/VideoCommon/DriverDetails.cpp10
-rw-r--r--Source/Core/VideoCommon/DriverDetails.h4
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp2
4 files changed, 33 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Metal/MTLUtil.mm b/Source/Core/VideoBackends/Metal/MTLUtil.mm
index b851a3d256..b20242e82a 100644
--- a/Source/Core/VideoBackends/Metal/MTLUtil.mm
+++ b/Source/Core/VideoBackends/Metal/MTLUtil.mm
@@ -10,6 +10,7 @@
#include "Common/MsgHandler.h"
+#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/Spirv.h"
Metal::DeviceFeatures Metal::g_features;
@@ -81,6 +82,21 @@ void Metal::Util::PopulateBackendInfoAdapters(VideoConfig* config,
void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice> device)
{
+ // Initialize DriverDetails first so we can use it later
+ DriverDetails::Vendor vendor = DriverDetails::VENDOR_UNKNOWN;
+ if ([[device name] containsString:@"NVIDIA"])
+ vendor = DriverDetails::VENDOR_NVIDIA;
+ else if ([[device name] containsString:@"AMD"])
+ vendor = DriverDetails::VENDOR_ATI;
+ else if ([[device name] containsString:@"Intel"])
+ vendor = DriverDetails::VENDOR_INTEL;
+ else if ([[device name] containsString:@"Apple"])
+ vendor = DriverDetails::VENDOR_APPLE;
+ const NSOperatingSystemVersion cocoa_ver = [[NSProcessInfo processInfo] operatingSystemVersion];
+ double version = cocoa_ver.majorVersion * 100 + cocoa_ver.minorVersion;
+ DriverDetails::Init(DriverDetails::API_METAL, vendor, DriverDetails::DRIVER_APPLE, version,
+ DriverDetails::Family::UNKNOWN);
+
#if TARGET_OS_OSX
config->backend_info.bSupportsDepthClamp = true;
config->backend_info.bSupportsST3CTextures = true;
@@ -117,11 +133,10 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
[device supportsFamily:MTLGPUFamilyMac2] || [device supportsFamily:MTLGPUFamilyApple6];
config->backend_info.bSupportsFramebufferFetch = [device supportsFamily:MTLGPUFamilyApple1];
}
- if ([[device name] containsString:@"AMD"])
- {
- // Broken
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SUBGROUP_INVOCATION_ID))
g_features.subgroup_ops = false;
- }
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING))
+ config->backend_info.bSupportsDynamicSamplerIndexing = false;
}
// clang-format off
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index d4d828e12e..f255460d74 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -98,6 +98,8 @@ constexpr BugInfo m_known_bugs[] = {
BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true},
+ {API_METAL, OS_OSX, VENDOR_INTEL, DRIVER_APPLE, Family::UNKNOWN,
+ BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true},
{API_OPENGL, OS_ALL, VENDOR_IMGTEC, DRIVER_IMGTEC, Family::UNKNOWN,
BUG_BROKEN_BITWISE_OP_NEGATION, -1.0, 108.4693462, true},
{API_VULKAN, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_PRIMITIVE_RESTART, -1.0,
@@ -120,6 +122,8 @@ constexpr BugInfo m_known_bugs[] = {
BUG_BROKEN_REVERSED_DEPTH_RANGE, -1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_ALL, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_REVERSED_DEPTH_RANGE, -1.0, -1.0, true},
+ {API_METAL, OS_OSX, VENDOR_ALL, DRIVER_APPLE, Family::UNKNOWN, BUG_BROKEN_REVERSED_DEPTH_RANGE,
+ -1.0, -1.0, true},
{API_VULKAN, OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_SLOW_CACHED_READBACK_MEMORY,
-1.0, -1.0, true},
{API_VULKAN, OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN,
@@ -130,6 +134,8 @@ constexpr BugInfo m_known_bugs[] = {
-1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_SUBGROUP_INVOCATION_ID, -1.0, -1.0, true},
+ {API_METAL, OS_OSX, VENDOR_ATI, DRIVER_APPLE, Family::UNKNOWN,
+ BUG_BROKEN_SUBGROUP_INVOCATION_ID, -1.0, -1.0, true},
{API_OPENGL, OS_ANDROID, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, true},
{API_VULKAN, OS_ANDROID, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
@@ -140,8 +146,12 @@ constexpr BugInfo m_known_bugs[] = {
-1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_APPLE, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_DISCARD_WITH_EARLY_Z, -1.0, -1.0, true},
+ {API_METAL, OS_OSX, VENDOR_APPLE, DRIVER_APPLE, Family::UNKNOWN,
+ BUG_BROKEN_DISCARD_WITH_EARLY_Z, -1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING, -1.0, -1.0, true},
+ {API_METAL, OS_OSX, VENDOR_INTEL, DRIVER_APPLE, Family::UNKNOWN,
+ BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING, -1.0, -1.0, true},
};
static std::map<Bug, BugInfo> m_bugs;
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index 646fa00f74..b7a7a5689f 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -13,7 +13,8 @@ namespace DriverDetails
enum API
{
API_OPENGL = (1 << 0),
- API_VULKAN = (1 << 1)
+ API_VULKAN = (1 << 1),
+ API_METAL = (1 << 2),
};
// Enum of supported operating systems
@@ -64,6 +65,7 @@ enum Driver
DRIVER_IMGTEC, // Official PowerVR driver
DRIVER_VIVANTE, // Official Vivante driver
DRIVER_PORTABILITY, // Vulkan via Metal on macOS
+ DRIVER_APPLE, // Metal on macOS
DRIVER_UNKNOWN // Unknown driver, default to official hardware driver
};
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index bf46764c0e..79d2bd1d52 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -810,7 +810,7 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
#ifdef __APPLE__
// Framebuffer fetch is only supported by Metal, so ensure that we're running Vulkan (MoltenVK)
// if we want to use it.
- if (api_type == APIType::Vulkan)
+ if (api_type == APIType::Vulkan || api_type == APIType::Metal)
{
if (!uid_data->no_dual_src)
{