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>2020-09-10 15:18:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-10 15:19:00 +0300
commit8d59f060ca73247b2265db04655eef9db0f1c06a (patch)
treeb9dd534a3dbe7ce805fa6f0fb11b0a9301fb8fde /source/blender/gpu/opengl/gl_backend.cc
parent9d5977f5e1fa2eac782278c61c3cc86685cc1b5a (diff)
GL: Wrap extension support inside GLContext
This makes it possible to disable all the extensions when forcing workarounds. Also it will allow future options to selectively disable each extension to know which one is buggy.
Diffstat (limited to 'source/blender/gpu/opengl/gl_backend.cc')
-rw-r--r--source/blender/gpu/opengl/gl_backend.cc46
1 files changed, 42 insertions, 4 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index 7285b9ad35c..edaa84cdcf8 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -209,11 +209,20 @@ static void detect_workarounds(void)
GCaps.mip_render_workaround = true;
GLContext::debug_layer_workaround = true;
GLContext::unused_fb_slot_workaround = true;
- GLContext::texture_copy_workaround = true;
/* Turn off extensions. */
GLContext::base_instance_support = false;
+ GLContext::clear_texture_support = false;
+ GLContext::copy_image_support = false;
GLContext::debug_layer_support = false;
+ GLContext::direct_state_access_support = false;
+ GLContext::fixed_restart_index_support = false;
+ GLContext::multi_bind_support = false;
+ GLContext::multi_draw_indirect_support = false;
+ GLContext::shader_draw_parameters_support = false;
GLContext::texture_cube_map_array_support = false;
+ GLContext::texture_filter_anisotropic_support = false;
+ GLContext::texture_gather_support = false;
+ GLContext::vertex_attrib_binding_support = false;
return;
}
@@ -268,7 +277,7 @@ static void detect_workarounds(void)
* covered since they only support GL 4.4 on windows.
* This fixes some issues with workbench anti-aliasing on Win + Intel GPU. (see T76273) */
if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_OFFICIAL) && !GLEW_VERSION_4_5) {
- GLContext::texture_copy_workaround = true;
+ GLContext::copy_image_support = false;
}
/* Special fix for theses specific GPUs.
* Without this workaround, blender crashes on startup. (see T72098) */
@@ -305,6 +314,11 @@ static void detect_workarounds(void)
strstr(version, "Mesa 19.1") || strstr(version, "Mesa 19.2"))) {
GLContext::unused_fb_slot_workaround = true;
}
+ /* There is a bug on older Nvidia GPU where GL_ARB_texture_gather
+ * is reported to be supported but yield a compile error (see T55802). */
+ if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY) && !GLEW_VERSION_4_0) {
+ GLContext::texture_gather_support = false;
+ }
/* dFdx/dFdy calculation factors, those are dependent on driver. */
if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY) &&
@@ -323,6 +337,11 @@ static void detect_workarounds(void)
GLContext::derivative_signs[1] = 1.0;
}
}
+
+ /* Disable multidraw if the base instance cannot be read. */
+ if (GLContext::shader_draw_parameters_support == false) {
+ GLContext::multi_draw_indirect_support = false;
+ }
/* Enable our own incomplete debug layer if no other is available. */
if (GLContext::debug_layer_support == false) {
GLContext::debug_layer_workaround = true;
@@ -336,11 +355,20 @@ GLint GLContext::max_ubo_size;
GLint GLContext::max_ubo_binds;
/** Extensions. */
bool GLContext::base_instance_support = false;
+bool GLContext::clear_texture_support = false;
+bool GLContext::copy_image_support = false;
bool GLContext::debug_layer_support = false;
+bool GLContext::direct_state_access_support = false;
+bool GLContext::fixed_restart_index_support = false;
+bool GLContext::multi_bind_support = false;
+bool GLContext::multi_draw_indirect_support = false;
+bool GLContext::shader_draw_parameters_support = false;
bool GLContext::texture_cube_map_array_support = false;
+bool GLContext::texture_filter_anisotropic_support = false;
+bool GLContext::texture_gather_support = false;
+bool GLContext::vertex_attrib_binding_support = false;
/** Workarounds. */
bool GLContext::debug_layer_workaround = false;
-bool GLContext::texture_copy_workaround = false;
bool GLContext::unused_fb_slot_workaround = false;
float GLContext::derivative_signs[2] = {1.0f, 1.0f};
@@ -361,8 +389,18 @@ void GLBackend::capabilities_init(void)
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &GLContext::max_ubo_binds);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &GLContext::max_ubo_size);
GLContext::base_instance_support = GLEW_ARB_base_instance;
- GLContext::texture_cube_map_array_support = GLEW_ARB_texture_cube_map_array;
+ GLContext::clear_texture_support = GLEW_ARB_clear_texture;
+ GLContext::copy_image_support = GLEW_ARB_copy_image;
GLContext::debug_layer_support = GLEW_VERSION_4_3 || GLEW_KHR_debug || GLEW_ARB_debug_output;
+ GLContext::direct_state_access_support = GLEW_ARB_direct_state_access;
+ GLContext::fixed_restart_index_support = GLEW_ARB_ES3_compatibility;
+ GLContext::multi_bind_support = GLEW_ARB_multi_bind;
+ GLContext::multi_draw_indirect_support = GLEW_ARB_multi_draw_indirect;
+ GLContext::shader_draw_parameters_support = GLEW_ARB_shader_draw_parameters;
+ GLContext::texture_cube_map_array_support = GLEW_ARB_texture_cube_map_array;
+ GLContext::texture_filter_anisotropic_support = GLEW_EXT_texture_filter_anisotropic;
+ GLContext::texture_gather_support = GLEW_ARB_texture_gather;
+ GLContext::vertex_attrib_binding_support = GLEW_ARB_vertex_attrib_binding;
detect_workarounds();