summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp26
-rw-r--r--src/video_core/renderer_opengl/gl_device.h5
2 files changed, 30 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index 1011c7738..447a19595 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -188,16 +188,32 @@ bool IsASTCSupported() {
188 return true; 188 return true;
189} 189}
190 190
191/// @brief Returns true when a GL_RENDERER is a Turing GPU
192/// @param renderer GL_RENDERER string
193bool IsTuring(std::string_view renderer) {
194 static constexpr std::array<std::string_view, 12> TURING_GPUS = {
195 "GTX 1650", "GTX 1660", "RTX 2060", "RTX 2070",
196 "RTX 2080", "TITAN RTX", "Quadro RTX 3000", "Quadro RTX 4000",
197 "Quadro RTX 5000", "Quadro RTX 6000", "Quadro RTX 8000", "Tesla T4",
198 };
199 return std::any_of(TURING_GPUS.begin(), TURING_GPUS.end(),
200 [renderer](std::string_view candidate) {
201 return renderer.find(candidate) != std::string_view::npos;
202 });
203}
204
191} // Anonymous namespace 205} // Anonymous namespace
192 206
193Device::Device() 207Device::Device()
194 : max_uniform_buffers{BuildMaxUniformBuffers()}, base_bindings{BuildBaseBindings()} { 208 : max_uniform_buffers{BuildMaxUniformBuffers()}, base_bindings{BuildBaseBindings()} {
195 const std::string_view vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); 209 const std::string_view vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
210 const std::string_view renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
196 const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION)); 211 const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
197 const std::vector extensions = GetExtensions(); 212 const std::vector extensions = GetExtensions();
198 213
199 const bool is_nvidia = vendor == "NVIDIA Corporation"; 214 const bool is_nvidia = vendor == "NVIDIA Corporation";
200 const bool is_amd = vendor == "ATI Technologies Inc."; 215 const bool is_amd = vendor == "ATI Technologies Inc.";
216 const bool is_turing = is_nvidia && IsTuring(renderer);
201 217
202 bool disable_fast_buffer_sub_data = false; 218 bool disable_fast_buffer_sub_data = false;
203 if (is_nvidia && version == "4.6.0 NVIDIA 443.24") { 219 if (is_nvidia && version == "4.6.0 NVIDIA 443.24") {
@@ -221,8 +237,16 @@ Device::Device()
221 has_variable_aoffi = TestVariableAoffi(); 237 has_variable_aoffi = TestVariableAoffi();
222 has_component_indexing_bug = is_amd; 238 has_component_indexing_bug = is_amd;
223 has_precise_bug = TestPreciseBug(); 239 has_precise_bug = TestPreciseBug();
224 has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
225 has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; 240 has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2;
241
242 // At the moment of writing this, only Nvidia's driver optimizes BufferSubData on exclusive
243 // uniform buffers as "push constants"
244 has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
245
246 // Nvidia's driver on Turing GPUs randomly crashes when the buffer is made resident, or on
247 // DeleteBuffers. Disable unified memory on these devices.
248 has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory && !is_turing;
249
226 use_assembly_shaders = Settings::values.use_assembly_shaders && GLAD_GL_NV_gpu_program5 && 250 use_assembly_shaders = Settings::values.use_assembly_shaders && GLAD_GL_NV_gpu_program5 &&
227 GLAD_GL_NV_compute_program5 && GLAD_GL_NV_transform_feedback && 251 GLAD_GL_NV_compute_program5 && GLAD_GL_NV_transform_feedback &&
228 GLAD_GL_NV_transform_feedback2; 252 GLAD_GL_NV_transform_feedback2;
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h
index c86e709b1..e1d811966 100644
--- a/src/video_core/renderer_opengl/gl_device.h
+++ b/src/video_core/renderer_opengl/gl_device.h
@@ -72,6 +72,10 @@ public:
72 return has_texture_shadow_lod; 72 return has_texture_shadow_lod;
73 } 73 }
74 74
75 bool HasVertexBufferUnifiedMemory() const {
76 return has_vertex_buffer_unified_memory;
77 }
78
75 bool HasASTC() const { 79 bool HasASTC() const {
76 return has_astc; 80 return has_astc;
77 } 81 }
@@ -115,6 +119,7 @@ private:
115 bool has_vertex_viewport_layer{}; 119 bool has_vertex_viewport_layer{};
116 bool has_image_load_formatted{}; 120 bool has_image_load_formatted{};
117 bool has_texture_shadow_lod{}; 121 bool has_texture_shadow_lod{};
122 bool has_vertex_buffer_unified_memory{};
118 bool has_astc{}; 123 bool has_astc{};
119 bool has_variable_aoffi{}; 124 bool has_variable_aoffi{};
120 bool has_component_indexing_bug{}; 125 bool has_component_indexing_bug{};