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.
This commit is contained in:
Jeroen Bakker 2022-05-11 15:19:10 +02:00
parent 3eb3d363e1
commit e354ba701a
Notes: blender-bot 2023-02-14 07:40:56 +01:00
Referenced by issue #97330, Adding subdivision surface modifier to default cube causes silent crash.
5 changed files with 10 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -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);

View File

@ -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. */