From d5f53da79d944869eb88416494ecf10a47eee90d Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 13 Dec 2022 12:30:15 -0500 Subject: renderer_opengl: refactor context acquire --- src/video_core/renderer_opengl/gl_device.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_device.cpp') diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index e2e3dac34..4c5020def 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -126,9 +126,11 @@ Device::Device() { const bool is_intel = vendor_name == "Intel"; #ifdef __unix__ - const bool is_linux = true; + constexpr bool is_linux = true; + const bool is_wayland = strcasecmp(getenv("XDG_SESSION_TYPE"), "wayland") == 0; #else - const bool is_linux = false; + constexpr bool is_linux = false; + constexpr bool is_wayland = false; #endif bool disable_fast_buffer_sub_data = false; @@ -194,9 +196,11 @@ Device::Device() { } // Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation. + // Blocks EGL on Wayland from using asynchronous shader compilation. use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue() && - !(is_amd || (is_intel && !is_linux)); + !(is_amd || (is_intel && !is_linux)) && !is_wayland; use_driver_cache = is_nvidia; + strict_context_required = is_wayland; LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug); -- cgit v1.2.3 From 09e3029c1118616394e5e9c45dfcdd4adcdf86ad Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 13 Dec 2022 14:39:03 -0500 Subject: gl_device: Use a more robust way to use strict context mode Instead of checking a environment variable which may not actually exist or is just wrong, ask QT if it's running on the wayland platform. --- src/video_core/renderer_opengl/gl_device.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_device.cpp') diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 4c5020def..cee5c3247 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -112,7 +112,7 @@ bool IsASTCSupported() { } } // Anonymous namespace -Device::Device() { +Device::Device(Core::Frontend::EmuWindow& emu_window) { if (!GLAD_GL_VERSION_4_6) { LOG_ERROR(Render_OpenGL, "OpenGL 4.6 is not available"); throw std::runtime_error{"Insufficient version"}; @@ -127,10 +127,8 @@ Device::Device() { #ifdef __unix__ constexpr bool is_linux = true; - const bool is_wayland = strcasecmp(getenv("XDG_SESSION_TYPE"), "wayland") == 0; #else constexpr bool is_linux = false; - constexpr bool is_wayland = false; #endif bool disable_fast_buffer_sub_data = false; @@ -195,12 +193,12 @@ Device::Device() { } } + strict_context_required = emu_window.StrictContextRequired(); // Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation. // Blocks EGL on Wayland from using asynchronous shader compilation. use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue() && - !(is_amd || (is_intel && !is_linux)) && !is_wayland; + !(is_amd || (is_intel && !is_linux)) && !strict_context_required; use_driver_cache = is_nvidia; - strict_context_required = is_wayland; LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi); LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug); -- cgit v1.2.3