Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-03-29 11:42:03 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-03-30 16:50:05 +0300
commit883326040ec20a8289e619446147792f62e6aa32 (patch)
tree8f86c7af33acdcb781df03975f1d197a4cfba6f8
parent05a77bb0d8f5aad9113d7a9aa1e1a7efb9342d6a (diff)
GL: Fix Invalid enum error on Apple Silicon
Guard shader storage related gets and bypass a buggy enum. Fix T95592 OpenGL Invalid Enum
-rw-r--r--source/blender/gpu/opengl/gl_backend.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index 2c9cbdb99d8..610fd5d980f 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -479,7 +479,14 @@ void GLBackend::capabilities_init()
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &GCaps.max_batch_indices);
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &GCaps.max_batch_vertices);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &GCaps.max_vertex_attribs);
- glGetIntegerv(GL_MAX_VARYING_FLOATS, &GCaps.max_varying_floats);
+ if (GPU_type_matches(GPU_DEVICE_APPLE, GPU_OS_MAC, GPU_DRIVER_OFFICIAL)) {
+ /* Due to a bug, querying GL_MAX_VARYING_FLOATS is emitting GL_INVALID_ENUM.
+ * Force use minimum required value. */
+ GCaps.max_varying_floats = 32;
+ }
+ else {
+ glGetIntegerv(GL_MAX_VARYING_FLOATS, &GCaps.max_varying_floats);
+ }
glGetIntegerv(GL_NUM_EXTENSIONS, &GCaps.extensions_len);
GCaps.extension_get = gl_extension_get;
@@ -502,9 +509,11 @@ void GLBackend::capabilities_init()
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &GLContext::max_texture_3d_size);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &GLContext::max_cubemap_size);
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &GLContext::max_ubo_binds);
- glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &GLContext::max_ssbo_binds);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &GLContext::max_ubo_size);
- glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &GLContext::max_ssbo_size);
+ if (GCaps.shader_storage_buffer_objects_support) {
+ glGetIntegerv(GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, &GLContext::max_ssbo_binds);
+ glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &GLContext::max_ssbo_size);
+ }
GLContext::base_instance_support = GLEW_ARB_base_instance;
GLContext::clear_texture_support = GLEW_ARB_clear_texture;
GLContext::copy_image_support = GLEW_ARB_copy_image;