diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-09-06 12:07:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-06 12:12:38 +0300 |
commit | 397e5c5526e596d1a2e295b117f5de1fe0a2888e (patch) | |
tree | 18f405340adcdc01f521ce916699898a614e77e1 /source/blender/gpu/opengl | |
parent | d7a67e245d700df73404967819ba62186bf049d9 (diff) |
GL: Require a minimum of 8 ssbo slot per shader stage
Otherwise we disable this feature. This is because some driver
does not support any vertex storage buffers but still support
8 ssbo in fragment shader.
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 4814a5ad71b..9051003bcd5 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -527,7 +527,18 @@ void GLBackend::capabilities_init() glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &GLContext::max_ubo_binds); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &GLContext::max_ubo_size); if (GCaps.shader_storage_buffer_objects_support) { - glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &GLContext::max_ssbo_binds); + GLint max_ssbo_binds; + GLContext::max_ssbo_binds = 999999; + glGetIntegerv(GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS, &max_ssbo_binds); + GLContext::max_ssbo_binds = min_ii(GLContext::max_ssbo_binds, max_ssbo_binds); + glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &max_ssbo_binds); + GLContext::max_ssbo_binds = min_ii(GLContext::max_ssbo_binds, max_ssbo_binds); + glGetIntegerv(GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS, &max_ssbo_binds); + GLContext::max_ssbo_binds = min_ii(GLContext::max_ssbo_binds, max_ssbo_binds); + if (GLContext::max_ssbo_binds < 8) { + /* Does not meet our minimum requirements. */ + GCaps.shader_storage_buffer_objects_support = false; + } glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &GLContext::max_ssbo_size); } GLContext::base_instance_support = epoxy_has_gl_extension("GL_ARB_base_instance"); |