diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_device.cpp | 43 |
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 | ||
| 109 | static 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(); |