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-09 01:47:59 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-10 15:19:00 +0300
commit9d5977f5e1fa2eac782278c61c3cc86685cc1b5a (patch)
treed88fad9af66de5ef23c50e12a886cee109342bbf /source/blender/gpu/opengl/gl_backend.cc
parentb8bcbb2cf26f7217099076e17d69088e690c0790 (diff)
GL: Add fallback debug layer
This is to improve debugging on older hardware that may not support 4.3 debug capabilities (like Macs). This avoids sprinkling glGetErrors manually. This might still be needed to find the root cause since not all functions are covered. This overrides the functions pointers that GLEW have already init. This is only enabled if using --debug-gpu option and the debug extension are not available. This also cleanup the usage of GLContext::debug_layer_support and use wrapper to set object labels.
Diffstat (limited to 'source/blender/gpu/opengl/gl_backend.cc')
-rw-r--r--source/blender/gpu/opengl/gl_backend.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index c8d57a20a38..7285b9ad35c 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -178,7 +178,7 @@ static bool detect_mip_render_workaround(void)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glDrawBuffer(GL_BACK);
+
/* Read mip 1. If color is not the same as the clear_color, the rendering failed. */
glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 1, GL_RGBA, GL_FLOAT, source_pix);
bool enable_workaround = !equals_v4v4(clear_color, source_pix);
@@ -207,10 +207,12 @@ static void detect_workarounds(void)
printf(" version: %s\n\n", version);
GCaps.depth_blitting_workaround = true;
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::debug_layer_support = false;
GLContext::texture_cube_map_array_support = false;
return;
}
@@ -321,6 +323,10 @@ static void detect_workarounds(void)
GLContext::derivative_signs[1] = 1.0;
}
}
+ /* Enable our own incomplete debug layer if no other is available. */
+ if (GLContext::debug_layer_support == false) {
+ GLContext::debug_layer_workaround = true;
+ }
}
/** Internal capabilities. */
@@ -333,6 +339,7 @@ bool GLContext::base_instance_support = false;
bool GLContext::debug_layer_support = false;
bool GLContext::texture_cube_map_array_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};
@@ -355,14 +362,15 @@ void GLBackend::capabilities_init(void)
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::debug_layer_support = (GLEW_VERSION_4_3 || GLEW_KHR_debug);
+ GLContext::debug_layer_support = GLEW_VERSION_4_3 || GLEW_KHR_debug || GLEW_ARB_debug_output;
+ detect_workarounds();
+
+ /* Disable this feature entirely when not debugging. */
if ((G.debug & G_DEBUG_GPU) == 0) {
- /* Disable this feature entierly when not debugging. */
GLContext::debug_layer_support = false;
+ GLContext::debug_layer_workaround = false;
}
-
- detect_workarounds();
}
/** \} */