summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2023-08-04 14:54:57 -0400
committerGravatar lat9nq2023-08-05 15:19:16 -0400
commitcb0b8442f0fb3ea155e61f46be62d92c9115d362 (patch)
tree0189eed3832f1a320ae55c43ada21e6dba55ddf1
parentMerge pull request #11209 from ameerj/subgroup_size_control (diff)
downloadyuzu-cb0b8442f0fb3ea155e61f46be62d92c9115d362.tar.gz
yuzu-cb0b8442f0fb3ea155e61f46be62d92c9115d362.tar.xz
yuzu-cb0b8442f0fb3ea155e61f46be62d92c9115d362.zip
gl_device: Filter more specifically for slow ASTC
Adds a check to find if the renderer is Intel DG (i.e. DG2). gl_device: Detect Mesa to disable their ASTC In our testing, our own ASTC decoder has shown itself to perform faster than the included one from the driver. Disable theirs when Mesa is detected. Mesa detection depends on the vendor string. Some drivers never appear outside of *nix contexts, so only check those in the *nix context. gl_device: Internalize Intel DG detection
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index ee140c9c2..94258ccd0 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -106,6 +106,43 @@ bool IsASTCSupported() {
106 return true; 106 return true;
107} 107}
108 108
109static bool HasSlowSoftwareAstc(std::string_view vendor_name, std::string_view renderer) {
110// ifdef for Unix reduces string comparisons for non-Windows drivers, and Intel
111#ifdef YUZU_UNIX
112 // Sorted vaguely by how likely a vendor is to appear
113 if (vendor_name == "AMD") {
114 // RadeonSI
115 return true;
116 }
117 if (vendor_name == "Intel") {
118 // Must be inside YUZU_UNIX ifdef as the Windows driver uses the same vendor string
119 // iris, crocus
120 const bool is_intel_dg = (renderer.find("DG") != std::string_view::npos);
121 return is_intel_dg;
122 }
123 if (vendor_name == "nouveau") {
124 return true;
125 }
126 if (vendor_name == "X.Org") {
127 // R600
128 return true;
129 }
130#endif
131 if (vendor_name == "Collabora Ltd") {
132 // Zink
133 return true;
134 }
135 if (vendor_name == "Microsoft Corporation") {
136 // d3d12
137 return true;
138 }
139 if (vendor_name == "Mesa/X.org") {
140 // llvmpipe, softpipe, virgl
141 return true;
142 }
143 return false;
144}
145
109[[nodiscard]] bool IsDebugToolAttached(std::span<const std::string_view> extensions) { 146[[nodiscard]] bool IsDebugToolAttached(std::span<const std::string_view> extensions) {
110 const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED"); 147 const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED");
111 return nsight || HasExtension(extensions, "GL_EXT_debug_tool") || 148 return nsight || HasExtension(extensions, "GL_EXT_debug_tool") ||
@@ -120,12 +157,16 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
120 } 157 }
121 vendor_name = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); 158 vendor_name = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
122 const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION)); 159 const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
160 const std::string_view renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
123 const std::vector extensions = GetExtensions(); 161 const std::vector extensions = GetExtensions();
124 162
125 const bool is_nvidia = vendor_name == "NVIDIA Corporation"; 163 const bool is_nvidia = vendor_name == "NVIDIA Corporation";
126 const bool is_amd = vendor_name == "ATI Technologies Inc."; 164 const bool is_amd = vendor_name == "ATI Technologies Inc.";
127 const bool is_intel = vendor_name == "Intel"; 165 const bool is_intel = vendor_name == "Intel";
128 166
167 const bool has_slow_software_astc =
168 !is_nvidia && !is_amd && HasSlowSoftwareAstc(vendor_name, renderer);
169
129#ifdef __unix__ 170#ifdef __unix__
130 constexpr bool is_linux = true; 171 constexpr bool is_linux = true;
131#else 172#else
@@ -152,7 +193,7 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
152 has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array; 193 has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array;
153 has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted"); 194 has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted");
154 has_texture_shadow_lod = HasExtension(extensions, "GL_EXT_texture_shadow_lod"); 195 has_texture_shadow_lod = HasExtension(extensions, "GL_EXT_texture_shadow_lod");
155 has_astc = IsASTCSupported(); 196 has_astc = !has_slow_software_astc && IsASTCSupported();
156 has_variable_aoffi = TestVariableAoffi(); 197 has_variable_aoffi = TestVariableAoffi();
157 has_component_indexing_bug = is_amd; 198 has_component_indexing_bug = is_amd;
158 has_precise_bug = TestPreciseBug(); 199 has_precise_bug = TestPreciseBug();