summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/OGLConfig.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2023-01-31 18:10:48 +0100
committerdegasus <wickmarkus@web.de>2023-02-09 13:27:02 +0100
commit4b2aa948e662aa037ad39f5ee81a64256a4d61aa (patch)
treec6bc567e6ee91b30e4317d726f0643779f916745 /Source/Core/VideoBackends/OGL/OGLConfig.cpp
parentaaad0cd39fca1ad020864ad7a141052179e7feb4 (diff)
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.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/OGLConfig.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/OGLConfig.cpp28
1 files changed, 25 insertions, 3 deletions
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