mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-11 22:49:56 +00:00
GS:MTL: GPU ROV feature detection
This commit is contained in:
committed by
lightningterror
parent
ff1b47942c
commit
1a13f9707b
@@ -1295,6 +1295,19 @@ bool GSDeviceMTL::UpdateWindow()
|
||||
|
||||
bool GSDeviceMTL::SupportsExclusiveFullscreen() const { return false; }
|
||||
|
||||
static const char* GetROVString(const GSMTLDevice::Features& features)
|
||||
{
|
||||
if (!features.rov)
|
||||
return "Unsupported";
|
||||
if (features.rov_requires_r32 && features.rov_requires_rt)
|
||||
return "With R32 Reinterpret and RT Texture";
|
||||
if (features.rov_requires_r32)
|
||||
return "With R32 Reinterpret";
|
||||
if (features.rov_requires_rt)
|
||||
return "With RT Texture";
|
||||
return "Supported";
|
||||
}
|
||||
|
||||
std::string GSDeviceMTL::GetDriverInfo() const
|
||||
{ @autoreleasepool {
|
||||
std::string desc([[m_dev.dev description] UTF8String]);
|
||||
@@ -1304,6 +1317,7 @@ std::string GSDeviceMTL::GetDriverInfo() const
|
||||
desc += "\n Memoryless Textures: " + std::string(m_dev.features.memoryless_textures ? "Supported" : "Unsupported");
|
||||
desc += "\n Primitive ID: " + std::string(m_dev.features.primid ? "Supported" : "Unsupported");
|
||||
desc += "\n Depth Feedback: " + std::string(m_dev.features.depth_feedback ? "Supported" : "Unsupported");
|
||||
desc += "\n ROV: " + std::string(GetROVString(m_dev.features));
|
||||
desc += "\n Shader Version: " + std::string(to_string(m_dev.features.shader_version));
|
||||
desc += "\n Max Texture Size: " + std::to_string(m_dev.features.max_texsize);
|
||||
return desc;
|
||||
|
||||
@@ -34,6 +34,9 @@ struct GSMTLDevice
|
||||
bool has_fast_half : 1;
|
||||
bool memoryless_textures : 1;
|
||||
bool depth_feedback : 1;
|
||||
bool rov : 1;
|
||||
bool rov_requires_rt : 1;
|
||||
bool rov_requires_r32 : 1;
|
||||
MetalVersion shader_version;
|
||||
int max_texsize;
|
||||
};
|
||||
|
||||
@@ -166,6 +166,9 @@ GSMTLDevice::GSMTLDevice(MRCOwned<id<MTLDevice>> dev)
|
||||
|
||||
features.depth_feedback = false;
|
||||
|
||||
features.rov = [dev areRasterOrderGroupsSupported];
|
||||
features.rov_requires_r32 = [dev readWriteTextureSupport] < MTLReadWriteTextureTier2;
|
||||
|
||||
NSString* name = [dev name];
|
||||
if ([name containsString:@"Intel"])
|
||||
{
|
||||
@@ -193,6 +196,9 @@ GSMTLDevice::GSMTLDevice(MRCOwned<id<MTLDevice>> dev)
|
||||
if (@available(macOS 13, iOS 16, *))
|
||||
if ([dev supportsFamily:MTLGPUFamilyMetal3])
|
||||
features.depth_feedback = true;
|
||||
// ROV doesn't work on AMD GPUs with no render target
|
||||
// Ideally the driver would insert a dummy texture for us (it does on Linux) but the Metal driver doesn't.
|
||||
features.rov_requires_rt = true;
|
||||
}
|
||||
else if ([name containsString:@"NVIDIA"])
|
||||
{
|
||||
@@ -219,6 +225,9 @@ GSMTLDevice::GSMTLDevice(MRCOwned<id<MTLDevice>> dev)
|
||||
else
|
||||
features.slow_color_compression = [[dev name] containsString:@"AMD"] || [[dev name] isEqualToString:@"Intel HD Graphics 4000"];
|
||||
|
||||
if (char* env = getenv("MTL_ROV_WITH_RT"))
|
||||
features.rov_requires_rt = env[0] == '1' || env[0] == 'y' || env[0] == 'Y';
|
||||
|
||||
features.max_texsize = GetMaxTextureSize(dev);
|
||||
|
||||
this->dev = std::move(dev);
|
||||
|
||||
Reference in New Issue
Block a user