summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-06-18 08:54:13 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-06-24 07:36:14 +0200
commit73fb3a304b215abce3cfb1c0c5eb2b43740b65ed (patch)
tree0b31d382ad261cd413c1d376867893db3066c369
parentgl_stream_buffer: Always use a non-coherent buffer (diff)
downloadyuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar.gz
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar.bz2
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar.lz
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar.xz
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.tar.zst
yuzu-73fb3a304b215abce3cfb1c0c5eb2b43740b65ed.zip
-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() {
return true;
}
+/// @brief Returns true when a GL_RENDERER is a Turing GPU
+/// @param renderer GL_RENDERER string
+bool IsTuring(std::string_view renderer) {
+ static constexpr std::array<std::string_view, 12> TURING_GPUS = {
+ "GTX 1650", "GTX 1660", "RTX 2060", "RTX 2070",
+ "RTX 2080", "TITAN RTX", "Quadro RTX 3000", "Quadro RTX 4000",
+ "Quadro RTX 5000", "Quadro RTX 6000", "Quadro RTX 8000", "Tesla T4",
+ };
+ return std::any_of(TURING_GPUS.begin(), TURING_GPUS.end(),
+ [renderer](std::string_view candidate) {
+ return renderer.find(candidate) != std::string_view::npos;
+ });
+}
+
} // Anonymous namespace
Device::Device()
: max_uniform_buffers{BuildMaxUniformBuffers()}, base_bindings{BuildBaseBindings()} {
const std::string_view vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
+ const std::string_view renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
const std::vector extensions = GetExtensions();
const bool is_nvidia = vendor == "NVIDIA Corporation";
const bool is_amd = vendor == "ATI Technologies Inc.";
+ const bool is_turing = is_nvidia && IsTuring(renderer);
bool disable_fast_buffer_sub_data = false;
if (is_nvidia && version == "4.6.0 NVIDIA 443.24") {
@@ -221,8 +237,16 @@ Device::Device()
has_variable_aoffi = TestVariableAoffi();
has_component_indexing_bug = is_amd;
has_precise_bug = TestPreciseBug();
- has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2;
+
+ // At the moment of writing this, only Nvidia's driver optimizes BufferSubData on exclusive
+ // uniform buffers as "push constants"
+ has_fast_buffer_sub_data = is_nvidia && !disable_fast_buffer_sub_data;
+
+ // Nvidia's driver on Turing GPUs randomly crashes when the buffer is made resident, or on
+ // DeleteBuffers. Disable unified memory on these devices.
+ has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory && !is_turing;
+
use_assembly_shaders = Settings::values.use_assembly_shaders && GLAD_GL_NV_gpu_program5 &&
GLAD_GL_NV_compute_program5 && GLAD_GL_NV_transform_feedback &&
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:
return has_texture_shadow_lod;
}
+ bool HasVertexBufferUnifiedMemory() const {
+ return has_vertex_buffer_unified_memory;
+ }
+
bool HasASTC() const {
return has_astc;
}
@@ -115,6 +119,7 @@ private:
bool has_vertex_viewport_layer{};
bool has_image_load_formatted{};
bool has_texture_shadow_lod{};
+ bool has_vertex_buffer_unified_memory{};
bool has_astc{};
bool has_variable_aoffi{};
bool has_component_indexing_bug{};