Merge pull request #12537 from TellowKrinkle/MTLSubgroup
VideoCommon: More specific subgroup op bugs
This commit is contained in:
commit
5c2f73986a
|
@ -134,6 +134,9 @@ public:
|
|||
// to once per game run.
|
||||
void ReportGameQuirk(GameQuirk quirk);
|
||||
|
||||
// Get the base builder for building a report
|
||||
const Common::AnalyticsReportBuilder& BaseBuilder() const { return m_base_builder; }
|
||||
|
||||
struct PerformanceSample
|
||||
{
|
||||
double speed_ratio; // See SystemTimers::GetEstimatedEmulationPerformance().
|
||||
|
|
|
@ -91,6 +91,68 @@ void Metal::Util::PopulateBackendInfoAdapters(VideoConfig* config,
|
|||
}
|
||||
}
|
||||
|
||||
/// For testing driver brokenness
|
||||
static bool RenderSinglePixel(id<MTLDevice> dev, id<MTLFunction> vs, id<MTLFunction> fs, //
|
||||
u32 px_in, u32* px_out)
|
||||
{
|
||||
auto pdesc = MRCTransfer([MTLRenderPipelineDescriptor new]);
|
||||
[pdesc setVertexFunction:vs];
|
||||
[pdesc setFragmentFunction:fs];
|
||||
[[pdesc colorAttachments][0] setPixelFormat:MTLPixelFormatRGBA8Unorm];
|
||||
auto pipe = MRCTransfer([dev newRenderPipelineStateWithDescriptor:pdesc error:nil]);
|
||||
if (!pipe)
|
||||
return false;
|
||||
auto buf = MRCTransfer([dev newBufferWithLength:4 options:MTLResourceStorageModeShared]);
|
||||
memcpy([buf contents], &px_in, sizeof(px_in));
|
||||
auto tdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA8Unorm
|
||||
width:1
|
||||
height:1
|
||||
mipmapped:false];
|
||||
[tdesc setUsage:MTLTextureUsageRenderTarget];
|
||||
auto tex = MRCTransfer([dev newTextureWithDescriptor:tdesc]);
|
||||
auto q = MRCTransfer([dev newCommandQueue]);
|
||||
id<MTLCommandBuffer> cmdbuf = [q commandBuffer];
|
||||
|
||||
id<MTLBlitCommandEncoder> upload_encoder = [cmdbuf blitCommandEncoder];
|
||||
[upload_encoder copyFromBuffer:buf
|
||||
sourceOffset:0
|
||||
sourceBytesPerRow:4
|
||||
sourceBytesPerImage:4
|
||||
sourceSize:MTLSizeMake(1, 1, 1)
|
||||
toTexture:tex
|
||||
destinationSlice:0
|
||||
destinationLevel:0
|
||||
destinationOrigin:MTLOriginMake(0, 0, 0)];
|
||||
[upload_encoder endEncoding];
|
||||
|
||||
auto rpdesc = MRCTransfer([MTLRenderPassDescriptor new]);
|
||||
[[rpdesc colorAttachments][0] setTexture:tex];
|
||||
[[rpdesc colorAttachments][0] setLoadAction:MTLLoadActionLoad];
|
||||
[[rpdesc colorAttachments][0] setStoreAction:MTLStoreActionStore];
|
||||
id<MTLRenderCommandEncoder> renc = [cmdbuf renderCommandEncoderWithDescriptor:rpdesc];
|
||||
[renc setRenderPipelineState:pipe];
|
||||
[renc drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3];
|
||||
[renc endEncoding];
|
||||
|
||||
id<MTLBlitCommandEncoder> download_encoder = [cmdbuf blitCommandEncoder];
|
||||
[download_encoder copyFromTexture:tex
|
||||
sourceSlice:0
|
||||
sourceLevel:0
|
||||
sourceOrigin:MTLOriginMake(0, 0, 0)
|
||||
sourceSize:MTLSizeMake(1, 1, 1)
|
||||
toBuffer:buf
|
||||
destinationOffset:0
|
||||
destinationBytesPerRow:4
|
||||
destinationBytesPerImage:4];
|
||||
[download_encoder endEncoding];
|
||||
|
||||
[cmdbuf commit];
|
||||
[cmdbuf waitUntilCompleted];
|
||||
|
||||
memcpy(px_out, [buf contents], sizeof(*px_out));
|
||||
return [cmdbuf status] == MTLCommandBufferStatusCompleted;
|
||||
}
|
||||
|
||||
static bool DetectIntelGPUFBFetch(id<MTLDevice> dev)
|
||||
{
|
||||
// Even though it's nowhere in the feature set tables, some Intel GPUs support fbfetch!
|
||||
|
@ -113,58 +175,14 @@ fragment float4 fbfetch_test(float4 in [[color(0), raster_order_group(0)]]) {
|
|||
error:nil]);
|
||||
if (!lib)
|
||||
return false;
|
||||
auto pdesc = MRCTransfer([MTLRenderPipelineDescriptor new]);
|
||||
[pdesc setVertexFunction:MRCTransfer([lib newFunctionWithName:@"fs_triangle"])];
|
||||
[pdesc setFragmentFunction:MRCTransfer([lib newFunctionWithName:@"fbfetch_test"])];
|
||||
[[pdesc colorAttachments][0] setPixelFormat:MTLPixelFormatRGBA8Unorm];
|
||||
auto pipe = MRCTransfer([dev newRenderPipelineStateWithDescriptor:pdesc error:nil]);
|
||||
if (!pipe)
|
||||
return false;
|
||||
auto buf = MRCTransfer([dev newBufferWithLength:4 options:MTLResourceStorageModeShared]);
|
||||
auto tdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA8Unorm
|
||||
width:1
|
||||
height:1
|
||||
mipmapped:false];
|
||||
[tdesc setUsage:MTLTextureUsageRenderTarget];
|
||||
auto tex = MRCTransfer([dev newTextureWithDescriptor:tdesc]);
|
||||
auto q = MRCTransfer([dev newCommandQueue]);
|
||||
u32 px = 0x11223344;
|
||||
memcpy([buf contents], &px, 4);
|
||||
id<MTLCommandBuffer> cmdbuf = [q commandBuffer];
|
||||
id<MTLBlitCommandEncoder> upload_encoder = [cmdbuf blitCommandEncoder];
|
||||
[upload_encoder copyFromBuffer:buf
|
||||
sourceOffset:0
|
||||
sourceBytesPerRow:4
|
||||
sourceBytesPerImage:4
|
||||
sourceSize:MTLSizeMake(1, 1, 1)
|
||||
toTexture:tex
|
||||
destinationSlice:0
|
||||
destinationLevel:0
|
||||
destinationOrigin:MTLOriginMake(0, 0, 0)];
|
||||
[upload_encoder endEncoding];
|
||||
auto rpdesc = MRCTransfer([MTLRenderPassDescriptor new]);
|
||||
[[rpdesc colorAttachments][0] setTexture:tex];
|
||||
[[rpdesc colorAttachments][0] setLoadAction:MTLLoadActionLoad];
|
||||
[[rpdesc colorAttachments][0] setStoreAction:MTLStoreActionStore];
|
||||
id<MTLRenderCommandEncoder> renc = [cmdbuf renderCommandEncoderWithDescriptor:rpdesc];
|
||||
[renc setRenderPipelineState:pipe];
|
||||
[renc drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3];
|
||||
[renc endEncoding];
|
||||
id<MTLBlitCommandEncoder> download_encoder = [cmdbuf blitCommandEncoder];
|
||||
[download_encoder copyFromTexture:tex
|
||||
sourceSlice:0
|
||||
sourceLevel:0
|
||||
sourceOrigin:MTLOriginMake(0, 0, 0)
|
||||
sourceSize:MTLSizeMake(1, 1, 1)
|
||||
toBuffer:buf
|
||||
destinationOffset:0
|
||||
destinationBytesPerRow:4
|
||||
destinationBytesPerImage:4];
|
||||
[download_encoder endEncoding];
|
||||
[cmdbuf commit];
|
||||
[cmdbuf waitUntilCompleted];
|
||||
u32 outpx;
|
||||
memcpy(&outpx, [buf contents], 4);
|
||||
bool ok = RenderSinglePixel(dev, //
|
||||
MRCTransfer([lib newFunctionWithName:@"fs_triangle"]), //
|
||||
MRCTransfer([lib newFunctionWithName:@"fbfetch_test"]), //
|
||||
0x11223344, &outpx);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
// Proper fbfetch will double contents, Haswell will return black, and Broadwell will do nothing
|
||||
if (outpx == 0x22446688)
|
||||
return true; // Skylake+
|
||||
|
@ -174,22 +192,69 @@ fragment float4 fbfetch_test(float4 in [[color(0), raster_order_group(0)]]) {
|
|||
return false; // Haswell
|
||||
}
|
||||
|
||||
enum class DetectionResult
|
||||
{
|
||||
Yes,
|
||||
No,
|
||||
Unsure
|
||||
};
|
||||
|
||||
static DetectionResult DetectInvertedIsHelper(id<MTLDevice> dev)
|
||||
{
|
||||
static constexpr const char* shader = R"(
|
||||
vertex float4 fs_triangle(uint vid [[vertex_id]]) {
|
||||
return float4(vid & 1 ? 3 : -1, vid & 2 ? 3 : -1, 0, 1);
|
||||
}
|
||||
fragment float4 is_helper_test() {
|
||||
float val = metal::simd_is_helper_thread() ? 1 : 0.5;
|
||||
return float4(val, metal::dfdx(val) + 0.5, metal::dfdy(val) + 0.5, 0);
|
||||
}
|
||||
)";
|
||||
|
||||
auto lib = MRCTransfer([dev newLibraryWithSource:[NSString stringWithUTF8String:shader]
|
||||
options:nil
|
||||
error:nil]);
|
||||
if (!lib)
|
||||
return DetectionResult::Unsure;
|
||||
|
||||
u32 outpx;
|
||||
bool ok = RenderSinglePixel(dev, //
|
||||
MRCTransfer([lib newFunctionWithName:@"fs_triangle"]), //
|
||||
MRCTransfer([lib newFunctionWithName:@"is_helper_test"]), //
|
||||
0, &outpx);
|
||||
|
||||
// The pixel itself should not be a helper thread (0.5)
|
||||
// The pixels to its right and below should be helper threads (1.0)
|
||||
// Correctly working would therefore be 0.5 for the pixel and (0.5 + 0.5) for the derivatives
|
||||
// Inverted would be 1.0 for the pixel and (-0.5 + 0.5) for the derivatives
|
||||
if (!ok)
|
||||
return DetectionResult::Unsure;
|
||||
if (outpx == 0xffff80)
|
||||
return DetectionResult::No; // Working correctly
|
||||
if (outpx == 0x0000ff)
|
||||
return DetectionResult::Yes; // Inverted
|
||||
WARN_LOG_FMT(VIDEO, "metal::simd_is_helper_thread might be broken! Test shader returned {:06x}!",
|
||||
outpx);
|
||||
return DetectionResult::Unsure;
|
||||
}
|
||||
|
||||
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"])
|
||||
std::string name = [[device name] UTF8String];
|
||||
if (name.find("NVIDIA") != std::string::npos)
|
||||
vendor = DriverDetails::VENDOR_NVIDIA;
|
||||
else if ([[device name] containsString:@"AMD"])
|
||||
else if (name.find("AMD") != std::string::npos)
|
||||
vendor = DriverDetails::VENDOR_ATI;
|
||||
else if ([[device name] containsString:@"Intel"])
|
||||
else if (name.find("Intel") != std::string::npos)
|
||||
vendor = DriverDetails::VENDOR_INTEL;
|
||||
else if ([[device name] containsString:@"Apple"])
|
||||
else if (name.find("Apple") != std::string::npos)
|
||||
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);
|
||||
DriverDetails::Family::UNKNOWN, std::move(name));
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
config->backend_info.bSupportsDepthClamp = true;
|
||||
|
@ -247,8 +312,16 @@ void Metal::Util::PopulateBackendInfoFeatures(VideoConfig* config, id<MTLDevice>
|
|||
[device supportsFamily:MTLGPUFamilyMac2] || [device supportsFamily:MTLGPUFamilyApple6];
|
||||
config->backend_info.bSupportsFramebufferFetch = [device supportsFamily:MTLGPUFamilyApple1];
|
||||
}
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SUBGROUP_OPS))
|
||||
g_features.subgroup_ops = false;
|
||||
if (g_features.subgroup_ops)
|
||||
{
|
||||
DetectionResult result = DetectInvertedIsHelper(device);
|
||||
if (result != DetectionResult::Unsure)
|
||||
{
|
||||
bool is_helper_inverted = result == DetectionResult::Yes;
|
||||
if (is_helper_inverted != DriverDetails::HasBug(DriverDetails::BUG_INVERTED_IS_HELPER))
|
||||
DriverDetails::OverrideBug(DriverDetails::BUG_INVERTED_IS_HELPER, is_helper_inverted);
|
||||
}
|
||||
}
|
||||
#if TARGET_OS_OSX
|
||||
if (@available(macOS 11, *))
|
||||
if (vendor == DriverDetails::VENDOR_INTEL)
|
||||
|
@ -436,22 +509,29 @@ std::optional<std::string> Metal::Util::TranslateShaderToMSL(ShaderStage stage,
|
|||
full_source.append(header);
|
||||
if (Metal::g_features.subgroup_ops)
|
||||
full_source.append(SUBGROUP_HELPER_HEADER);
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_INVERTED_IS_HELPER))
|
||||
{
|
||||
full_source.append("#define gl_HelperInvocation !gl_HelperInvocation "
|
||||
"// Work around broken AMD Metal driver\n");
|
||||
}
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD))
|
||||
full_source.append("#define BROKEN_SUBGROUP_WITH_DISCARD 1\n");
|
||||
full_source.append(source);
|
||||
|
||||
std::optional<SPIRV::CodeVector> code;
|
||||
switch (stage)
|
||||
{
|
||||
case ShaderStage::Vertex:
|
||||
code = SPIRV::CompileVertexShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_3);
|
||||
code = SPIRV::CompileVertexShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_5);
|
||||
break;
|
||||
case ShaderStage::Geometry:
|
||||
PanicAlertFmt("Tried to compile geometry shader for Metal, but Metal doesn't support them!");
|
||||
break;
|
||||
case ShaderStage::Pixel:
|
||||
code = SPIRV::CompileFragmentShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_3);
|
||||
code = SPIRV::CompileFragmentShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_5);
|
||||
break;
|
||||
case ShaderStage::Compute:
|
||||
code = SPIRV::CompileComputeShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_3);
|
||||
code = SPIRV::CompileComputeShader(full_source, APIType::Metal, glslang::EShTargetSpv_1_5);
|
||||
break;
|
||||
}
|
||||
if (!code.has_value())
|
||||
|
|
|
@ -211,7 +211,8 @@ void InitDriverInfo()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
DriverDetails::Init(DriverDetails::API_OPENGL, vendor, driver, version, family);
|
||||
DriverDetails::Init(DriverDetails::API_OPENGL, vendor, driver, version, family,
|
||||
std::string(srenderer));
|
||||
}
|
||||
|
||||
bool PopulateConfig(GLContext* m_main_gl_context)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "VideoBackends/Vulkan/VulkanContext.h"
|
||||
#include "VideoCommon/DriverDetails.h"
|
||||
#include "VideoCommon/Spirv.h"
|
||||
|
||||
namespace Vulkan::ShaderCompiler
|
||||
|
@ -98,6 +99,13 @@ static std::string GetShaderCode(std::string_view source, std::string_view heade
|
|||
full_source_code.append(header);
|
||||
if (g_vulkan_context->SupportsShaderSubgroupOperations())
|
||||
full_source_code.append(SUBGROUP_HELPER_HEADER, subgroup_helper_header_length);
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_INVERTED_IS_HELPER))
|
||||
{
|
||||
full_source_code.append("#define gl_HelperInvocation !gl_HelperInvocation "
|
||||
"// Work around broken AMD Metal driver\n");
|
||||
}
|
||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD))
|
||||
full_source_code.append("#define BROKEN_SUBGROUP_WITH_DISCARD 1\n");
|
||||
full_source_code.append(source);
|
||||
}
|
||||
|
||||
|
|
|
@ -967,7 +967,7 @@ void VulkanContext::InitDriverDetails()
|
|||
|
||||
DriverDetails::Init(DriverDetails::API_VULKAN, vendor, driver,
|
||||
static_cast<double>(m_device_properties.driverVersion),
|
||||
DriverDetails::Family::UNKNOWN);
|
||||
DriverDetails::Family::UNKNOWN, std::move(device_name));
|
||||
}
|
||||
|
||||
void VulkanContext::PopulateShaderSubgroupSupport()
|
||||
|
@ -1000,8 +1000,7 @@ void VulkanContext::PopulateShaderSubgroupSupport()
|
|||
VK_SUBGROUP_FEATURE_BALLOT_BIT | VK_SUBGROUP_FEATURE_SHUFFLE_BIT;
|
||||
m_supports_shader_subgroup_operations =
|
||||
(subgroup_properties.supportedOperations & required_operations) == required_operations &&
|
||||
subgroup_properties.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT &&
|
||||
!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SUBGROUP_OPS);
|
||||
subgroup_properties.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
}
|
||||
|
||||
bool VulkanContext::SupportsExclusiveFullscreen(const WindowSystemInfo& wsi, VkSurfaceKHR surface)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <map>
|
||||
|
||||
#include "Common/Logging/LogManager.h"
|
||||
#include "Core/DolphinAnalytics.h"
|
||||
|
||||
namespace DriverDetails
|
||||
{
|
||||
|
@ -46,6 +47,7 @@ static Vendor m_vendor = VENDOR_UNKNOWN;
|
|||
static Driver m_driver = DRIVER_UNKNOWN;
|
||||
static Family m_family = Family::UNKNOWN;
|
||||
static double m_version = 0.0;
|
||||
static std::string m_name;
|
||||
|
||||
// This is a list of all known bugs for each vendor
|
||||
// We use this to check if the device and driver has a issue
|
||||
|
@ -130,14 +132,14 @@ constexpr BugInfo m_known_bugs[] = {
|
|||
-1.0, -1.0, true},
|
||||
{API_VULKAN, OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKEN_VECTOR_BITWISE_AND,
|
||||
-1.0, -1.0, true},
|
||||
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN, BUG_BROKEN_SUBGROUP_OPS,
|
||||
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN, BUG_INVERTED_IS_HELPER,
|
||||
-1.0, -1.0, true},
|
||||
{API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN, BUG_BROKEN_SUBGROUP_OPS,
|
||||
-1.0, -1.0, true},
|
||||
{API_METAL, OS_OSX, VENDOR_ATI, DRIVER_APPLE, Family::UNKNOWN, BUG_BROKEN_SUBGROUP_OPS, -1.0,
|
||||
-1.0, true},
|
||||
{API_METAL, OS_OSX, VENDOR_INTEL, DRIVER_APPLE, Family::UNKNOWN, BUG_BROKEN_SUBGROUP_OPS, -1.0,
|
||||
{API_METAL, OS_OSX, VENDOR_ATI, DRIVER_APPLE, Family::UNKNOWN, BUG_INVERTED_IS_HELPER, -1.0,
|
||||
-1.0, true},
|
||||
{API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN,
|
||||
BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD, -1.0, -1.0, true},
|
||||
{API_METAL, OS_OSX, VENDOR_INTEL, DRIVER_APPLE, Family::UNKNOWN,
|
||||
BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD, -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,
|
||||
|
@ -160,13 +162,15 @@ constexpr BugInfo m_known_bugs[] = {
|
|||
|
||||
static std::map<Bug, BugInfo> m_bugs;
|
||||
|
||||
void Init(API api, Vendor vendor, Driver driver, const double version, const Family family)
|
||||
void Init(API api, Vendor vendor, Driver driver, const double version, const Family family,
|
||||
std::string name)
|
||||
{
|
||||
m_api = api;
|
||||
m_vendor = vendor;
|
||||
m_driver = driver;
|
||||
m_version = version;
|
||||
m_family = family;
|
||||
m_name = std::move(name);
|
||||
|
||||
if (driver == DRIVER_UNKNOWN)
|
||||
{
|
||||
|
@ -217,4 +221,106 @@ bool HasBug(Bug bug)
|
|||
return false;
|
||||
return it->second.m_hasbug;
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
// Make sure we handle all these switch cases
|
||||
#pragma clang diagnostic error "-Wswitch"
|
||||
#pragma clang diagnostic error "-Wcovered-switch-default"
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
|
||||
static const char* to_string(API api)
|
||||
{
|
||||
switch (api)
|
||||
{
|
||||
case API_OPENGL: return "OpenGL";
|
||||
case API_VULKAN: return "Vulkan";
|
||||
case API_METAL: return "Metal";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
static const char* to_string(Driver driver)
|
||||
{
|
||||
switch (driver)
|
||||
{
|
||||
case DRIVER_ALL: return "All";
|
||||
case DRIVER_NVIDIA: return "Nvidia";
|
||||
case DRIVER_NOUVEAU: return "Nouveau";
|
||||
case DRIVER_ATI: return "ATI";
|
||||
case DRIVER_R600: return "R600";
|
||||
case DRIVER_INTEL: return "Intel";
|
||||
case DRIVER_I965: return "I965";
|
||||
case DRIVER_ARM: return "ARM";
|
||||
case DRIVER_LIMA: return "Lima";
|
||||
case DRIVER_QUALCOMM: return "Qualcomm";
|
||||
case DRIVER_FREEDRENO: return "Freedreno";
|
||||
case DRIVER_IMGTEC: return "Imgtech";
|
||||
case DRIVER_VIVANTE: return "Vivante";
|
||||
case DRIVER_PORTABILITY: return "Portability";
|
||||
case DRIVER_APPLE: return "Apple";
|
||||
case DRIVER_UNKNOWN: return "Unknown";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
static const char* to_string(Bug bug)
|
||||
{
|
||||
switch (bug)
|
||||
{
|
||||
case BUG_BROKEN_UBO: return "broken-ubo";
|
||||
case BUG_BROKEN_PINNED_MEMORY: return "broken-pinned-memory";
|
||||
case BUG_BROKEN_BUFFER_STREAM: return "broken-buffer-stream";
|
||||
case BUG_BROKEN_BUFFER_STORAGE: return "broken-buffer-storage";
|
||||
case BUG_PRIMITIVE_RESTART: return "primitive-restart";
|
||||
case BUG_BROKEN_UNSYNC_MAPPING: return "broken-unsync-mapping";
|
||||
case BUG_INTEL_BROKEN_BUFFER_STORAGE: return "intel-broken-buffer-storage";
|
||||
case BUG_BROKEN_NEGATED_BOOLEAN: return "broken-negated-boolean";
|
||||
case BUG_BROKEN_COPYIMAGE: return "broken-copyimage";
|
||||
case BUG_BROKEN_VSYNC: return "broken-vsync";
|
||||
case BUG_BROKEN_GEOMETRY_SHADERS: return "broken-geometry-shaders";
|
||||
case BUG_SLOW_GETBUFFERSUBDATA: return "slow-getBufferSubData";
|
||||
case BUG_BROKEN_CLIP_DISTANCE: return "broken-clip-distance";
|
||||
case BUG_BROKEN_DUAL_SOURCE_BLENDING: return "broken-dual-source-blending";
|
||||
case BUG_BROKEN_BITWISE_OP_NEGATION: return "broken-bitwise-op-negation";
|
||||
case BUG_SHARED_CONTEXT_SHADER_COMPILATION: return "shared-context-shader-compilation";
|
||||
case BUG_BROKEN_MSAA_CLEAR: return "broken-msaa-clear";
|
||||
case BUG_BROKEN_CLEAR_LOADOP_RENDERPASS: return "broken-clear-loadop-renderpass";
|
||||
case BUG_BROKEN_D32F_CLEAR: return "broken-d32f-clear";
|
||||
case BUG_BROKEN_REVERSED_DEPTH_RANGE: return "broken-reversed-depth-range";
|
||||
case BUG_SLOW_CACHED_READBACK_MEMORY: return "slow-cached-readback-memory";
|
||||
case BUG_BROKEN_VECTOR_BITWISE_AND: return "broken-vector-bitwise-and";
|
||||
case BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD: return "broken-subgroup-ops-with-discard";
|
||||
case BUG_INVERTED_IS_HELPER: return "inverted-is-helper";
|
||||
case BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION: return "broken-multithreaded-shader-precompilation";
|
||||
case BUG_BROKEN_DISCARD_WITH_EARLY_Z: return "broken-discard-with-early-z";
|
||||
case BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING: return "broken-dynamic-sampler-indexing";
|
||||
case BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY: return "slow-optimal-image-to-buffer-copy";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
||||
void OverrideBug(Bug bug, bool new_value)
|
||||
{
|
||||
const auto [it, added] = m_bugs.try_emplace(
|
||||
bug, BugInfo{m_api, m_os, m_vendor, m_driver, m_family, bug, -1, -1, false});
|
||||
if (it->second.m_hasbug != new_value)
|
||||
{
|
||||
DolphinAnalytics& analytics = DolphinAnalytics::Instance();
|
||||
Common::AnalyticsReportBuilder builder(analytics.BaseBuilder());
|
||||
builder.AddData("type", "gpu-bug-override");
|
||||
builder.AddData("bug", to_string(bug));
|
||||
builder.AddData("value", new_value);
|
||||
builder.AddData("gpu", m_name);
|
||||
builder.AddData("api", to_string(m_api));
|
||||
builder.AddData("driver", to_string(m_driver));
|
||||
builder.AddData("version", std::to_string(m_version));
|
||||
analytics.Send(builder);
|
||||
|
||||
it->second.m_hasbug = new_value;
|
||||
}
|
||||
}
|
||||
} // namespace DriverDetails
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2013 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#undef OS // CURL defines that, nobody uses it...
|
||||
|
@ -299,14 +300,23 @@ enum Bug
|
|||
|
||||
// BUG: Accessing gl_SubgroupInvocationID causes the Metal shader compiler to crash.
|
||||
// Affected devices: AMD (older macOS)
|
||||
// BUG: gl_HelperInvocation always returns true, even for non-helper invocations
|
||||
// Affected devices: AMD (newer macOS)
|
||||
// Started version: ???
|
||||
// Ended version: ???
|
||||
// (Workaround currently disabled, will put it back when someone hits the issue and we can
|
||||
// find out what devices and OSes it actually affects)
|
||||
|
||||
// BUG: Using subgroupMax in a shader that can discard results in garbage data
|
||||
// (For some reason, this only happens at 4x+ IR on Metal, but 2x+ IR on MoltenVK)
|
||||
// Affected devices: Intel (macOS)
|
||||
// Started version: -1
|
||||
// Ended version: -1
|
||||
BUG_BROKEN_SUBGROUP_OPS,
|
||||
BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD,
|
||||
|
||||
// BUG: gl_HelperInvocation is actually !gl_HelperInvocation
|
||||
// Affected devices: AMD (macOS)
|
||||
// Started version: -1
|
||||
// Ended version: -1
|
||||
BUG_INVERTED_IS_HELPER,
|
||||
|
||||
// BUG: Multi-threaded shader pre-compilation sometimes crashes
|
||||
// Used primarily in Videoconfig.cpp's GetNumAutoShaderPreCompilerThreads()
|
||||
|
@ -336,9 +346,13 @@ enum Bug
|
|||
};
|
||||
|
||||
// Initializes our internal vendor, device family, and driver version
|
||||
void Init(API api, Vendor vendor, Driver driver, const double version, const Family family);
|
||||
void Init(API api, Vendor vendor, Driver driver, const double version, const Family family,
|
||||
std::string name);
|
||||
|
||||
// Once Vendor and driver version is set, this will return if it has the applicable bug passed to
|
||||
// it.
|
||||
bool HasBug(Bug bug);
|
||||
|
||||
// Overrides the current state of a bug
|
||||
void OverrideBug(Bug bug, bool new_value);
|
||||
} // namespace DriverDetails
|
||||
|
|
|
@ -485,7 +485,7 @@ void UpdateBoundingBox(float2 rawpos) {{
|
|||
int2 pos_tl = pos & ~1; // round down to even
|
||||
int2 pos_br = pos | 1; // round up to odd
|
||||
|
||||
#ifdef SUPPORTS_SUBGROUP_REDUCTION
|
||||
#if defined(SUPPORTS_SUBGROUP_REDUCTION) && !defined(BROKEN_SUBGROUP_WITH_DISCARD)
|
||||
if (!IS_HELPER_INVOCATION)
|
||||
{{
|
||||
SUBGROUP_MIN(pos_tl);
|
||||
|
|
Loading…
Reference in New Issue