[Bf-blender-cvs] [73f1f51627a] temp-pbvh-split: Fix T97330: GPU Subdiv compiler error.

Jeroen Bakker noreply at git.blender.org
Fri Jun 3 01:16:31 CEST 2022


Commit: 73f1f51627afb45db7942df27256bd0ade8f3e3d
Author: Jeroen Bakker
Date:   Wed May 11 15:19:10 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB73f1f51627afb45db7942df27256bd0ade8f3e3d

Fix T97330: GPU Subdiv compiler error.

GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.

===================================================================

M	source/blender/blenkernel/intern/subdiv_modifier.c
M	source/blender/gpu/GPU_capabilities.h
M	source/blender/gpu/intern/gpu_capabilities.cc
M	source/blender/gpu/intern/gpu_capabilities_private.hh
M	source/blender/gpu/opengl/gl_backend.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/subdiv_modifier.c b/source/blender/blenkernel/intern/subdiv_modifier.c
index 83772f153d9..3692a3cc4f7 100644
--- a/source/blender/blenkernel/intern/subdiv_modifier.c
+++ b/source/blender/blenkernel/intern/subdiv_modifier.c
@@ -77,7 +77,7 @@ static bool is_subdivision_evaluation_possible_on_gpu(void)
     return false;
   }
 
-  if (GPU_max_shader_storage_buffer_bindings() < MAX_GPU_SUBDIV_SSBOS) {
+  if (GPU_max_compute_shader_storage_blocks() < MAX_GPU_SUBDIV_SSBOS) {
     return false;
   }
 
diff --git a/source/blender/gpu/GPU_capabilities.h b/source/blender/gpu/GPU_capabilities.h
index aedac168a01..061b850619f 100644
--- a/source/blender/gpu/GPU_capabilities.h
+++ b/source/blender/gpu/GPU_capabilities.h
@@ -30,6 +30,7 @@ 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_max_compute_shader_storage_blocks(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 72b62b3de3d..6ef015492c7 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -167,6 +167,12 @@ int GPU_max_shader_storage_buffer_bindings()
   return GCaps.max_shader_storage_buffer_bindings;
 }
 
+int GPU_max_compute_shader_storage_blocks()
+{
+  return GCaps.max_compute_shader_storage_blocks;
+}
+
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh
index 611c2d6973c..a17dbe7f8e6 100644
--- a/source/blender/gpu/intern/gpu_capabilities_private.hh
+++ b/source/blender/gpu/intern/gpu_capabilities_private.hh
@@ -36,6 +36,7 @@ struct GPUCapabilities {
   int max_vertex_attribs = 0;
   int max_varying_floats = 0;
   int max_shader_storage_buffer_bindings = 0;
+  int max_compute_shader_storage_blocks = 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 0ce01d80a77..17d9b392c69 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -510,6 +510,7 @@ void GLBackend::capabilities_init()
     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);
+    glGetIntegerv(GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS, &GCaps.max_compute_shader_storage_blocks);
   }
   GCaps.shader_storage_buffer_objects_support = GLEW_ARB_shader_storage_buffer_object;
   /* GL specific capabilities. */



More information about the Bf-blender-cvs mailing list