diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-15 18:07:32 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-15 18:07:32 +0300 |
commit | 3bb4597b2d23d5d3afd342c432b5cac23e2ba755 (patch) | |
tree | ad5a4b2493c565775576651771334cc6af6de9fa /source/blender/blenkernel | |
parent | 45b637e1e79f817b182031246233c29a4344d159 (diff) |
Disable GPU subdivision if the maximum number of SSBO binding is reached
Some old platforms and drivers have limited amount of SSBO binding per
compute shader. This disables GPU subdivision if we cannot possibly
bind all required buffers within this limit.
For now the maximum number of buffers used by the GPU code is hardcoded,
but will be programmatically detected when shader creation is automated.
Ref D14337
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv_modifier.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_modifier.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_modifier.h b/source/blender/blenkernel/BKE_subdiv_modifier.h index 40e8ee2f999..e9de7d1532e 100644 --- a/source/blender/blenkernel/BKE_subdiv_modifier.h +++ b/source/blender/blenkernel/BKE_subdiv_modifier.h @@ -13,6 +13,10 @@ extern "C" { #endif +/* Hardcoded for until GPU shaders are automatically generated, then we will have a more + * programmatic way of detecting this. */ +#define MAX_GPU_SUBDIV_SSBOS 12 + struct Mesh; struct Object; struct Scene; diff --git a/source/blender/blenkernel/intern/subdiv_modifier.c b/source/blender/blenkernel/intern/subdiv_modifier.c index 34dfdaf7595..83772f153d9 100644 --- a/source/blender/blenkernel/intern/subdiv_modifier.c +++ b/source/blender/blenkernel/intern/subdiv_modifier.c @@ -77,6 +77,10 @@ static bool is_subdivision_evaluation_possible_on_gpu(void) return false; } + if (GPU_max_shader_storage_buffer_bindings() < MAX_GPU_SUBDIV_SSBOS) { + return false; + } + const int available_evaluators = openSubdiv_getAvailableEvaluators(); if ((available_evaluators & OPENSUBDIV_EVALUATOR_GLSL_COMPUTE) == 0) { return false; |