From 4b2aa948e662aa037ad39f5ee81a64256a4d61aa Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 31 Jan 2023 18:10:48 +0100 Subject: VideoBackend/OGL: Prefer KHR_subgroup over NV_shader_thread. While the NV extension is totally fine, the KHR extension should be able to support more hardware. For NVIDIA, the hardware either supports both or neither, it just needs a driver from the last two years. For AMD, the drivers from late 2022-12 seems to bring support for the KHR extension. For Intel, the KHR is also supported for some years. --- Source/Core/VideoBackends/OGL/OGLConfig.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoBackends/OGL/OGLConfig.cpp') diff --git a/Source/Core/VideoBackends/OGL/OGLConfig.cpp b/Source/Core/VideoBackends/OGL/OGLConfig.cpp index bafc28841d..10722e0526 100644 --- a/Source/Core/VideoBackends/OGL/OGLConfig.cpp +++ b/Source/Core/VideoBackends/OGL/OGLConfig.cpp @@ -489,7 +489,14 @@ bool PopulateConfig(GLContext* m_main_gl_context) else if (GLExtensions::Version() >= 430) { // TODO: We should really parse the GL_SHADING_LANGUAGE_VERSION token. - g_ogl_config.eSupportedGLSLVersion = Glsl430; + if (GLExtensions::Version() >= 450) + { + g_ogl_config.eSupportedGLSLVersion = Glsl450; + } + else + { + g_ogl_config.eSupportedGLSLVersion = Glsl430; + } g_ogl_config.bSupportsTextureStorage = true; g_ogl_config.bSupportsImageLoadStore = true; g_Config.backend_info.bSupportsSSAA = true; @@ -531,8 +538,23 @@ bool PopulateConfig(GLContext* m_main_gl_context) if (g_ogl_config.max_samples < 1 || !g_ogl_config.bSupportsMSAA) g_ogl_config.max_samples = 1; - g_ogl_config.bSupportsShaderThreadShuffleNV = - GLExtensions::Supports("GL_NV_shader_thread_shuffle"); + const bool bSupportsIsHelperInvocation = g_ogl_config.bIsES ? + g_ogl_config.eSupportedGLSLVersion >= GlslEs320 : + g_ogl_config.eSupportedGLSLVersion >= Glsl450; + g_ogl_config.bSupportsKHRShaderSubgroup = + GLExtensions::Supports("GL_KHR_shader_subgroup") && bSupportsIsHelperInvocation; + if (g_ogl_config.bSupportsKHRShaderSubgroup) + { + // Check for the features: basic + arithmetic + ballot + GLint supported_features = 0; + glGetIntegerv(GL_SUBGROUP_SUPPORTED_FEATURES_KHR, &supported_features); + if (~supported_features & + (GL_SUBGROUP_FEATURE_BASIC_BIT_KHR | GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR | + GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR)) + { + g_ogl_config.bSupportsKHRShaderSubgroup = false; + } + } // We require texel buffers, image load store, and compute shaders to enable GPU texture decoding. // If the driver doesn't expose the extensions, but supports GL4.3/GLES3.1, it will still be -- cgit v1.2.3