diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-15 18:04:41 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-15 18:04:41 +0300 |
commit | 45b637e1e79f817b182031246233c29a4344d159 (patch) | |
tree | 3b29920b99ee194a88d110b7a4a3b258359035be /source | |
parent | e08180fdab8925328ed505333f6e5a721b18e0b4 (diff) |
GPU capabilities: detect max SSBO bindings
This adds detection of the maximum number of shader storage buffer
bindings that is supported on the current platform. This can be
useful to turn off features that require compute shaders but use
more buffer bindings than available.
Differential Revision: https://developer.blender.org/D14337
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_capabilities.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities.cc | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities_private.hh | 1 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 2 |
4 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_capabilities.h b/source/blender/gpu/GPU_capabilities.h index 672139aa407..0d0542aa528 100644 --- a/source/blender/gpu/GPU_capabilities.h +++ b/source/blender/gpu/GPU_capabilities.h @@ -29,6 +29,7 @@ int GPU_max_batch_indices(void); int GPU_max_batch_vertices(void); int GPU_max_vertex_attribs(void); int GPU_max_varying_floats(void); +int GPU_max_shader_storage_buffer_bindings(void); int GPU_extensions_len(void); const char *GPU_extension_get(int i); diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index 66e3a71317a..b750dacaca6 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -157,6 +157,11 @@ bool GPU_shader_image_load_store_support() return GCaps.shader_image_load_store_support; } +int GPU_max_shader_storage_buffer_bindings() +{ + return GCaps.max_shader_storage_buffer_bindings; +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index 458047ea6ad..d645d82a879 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -33,6 +33,7 @@ struct GPUCapabilities { int max_batch_vertices = 0; int max_vertex_attribs = 0; int max_varying_floats = 0; + int max_shader_storage_buffer_bindings = 0; int extensions_len = 0; const char *(*extension_get)(int); diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index f0d7a23ef82..9885b16966b 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -485,6 +485,8 @@ void GLBackend::capabilities_init() glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, &GCaps.max_work_group_size[0]); glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, &GCaps.max_work_group_size[1]); glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, &GCaps.max_work_group_size[2]); + glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, + &GCaps.max_shader_storage_buffer_bindings); } GCaps.shader_storage_buffer_objects_support = GLEW_ARB_shader_storage_buffer_object; /* GL specific capabilities. */ |