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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/opengl/gl_backend.cc12
-rw-r--r--source/blender/gpu/opengl/gl_context.hh1
-rw-r--r--source/blender/gpu/opengl/gl_debug.cc2
-rw-r--r--source/blender/gpu/opengl/gl_debug.hh2
-rw-r--r--source/blender/gpu/opengl/gl_debug_layer.cc15
5 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index d1ebe9c2123..ea1573153f8 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -321,6 +321,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::base_instance_support == false) {
+ GLContext::debug_layer_workaround = true;
+ }
}
/** Internal capabilities. */
@@ -333,6 +337,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};
@@ -357,12 +362,13 @@ void GLBackend::capabilities_init(void)
GLContext::texture_cube_map_array_support = GLEW_ARB_texture_cube_map_array;
GLContext::debug_layer_support = (GLEW_VERSION_4_3 || GLEW_KHR_debug);
+ 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();
}
/** \} */
diff --git a/source/blender/gpu/opengl/gl_context.hh b/source/blender/gpu/opengl/gl_context.hh
index 10ae396d138..1cef6e61425 100644
--- a/source/blender/gpu/opengl/gl_context.hh
+++ b/source/blender/gpu/opengl/gl_context.hh
@@ -65,6 +65,7 @@ class GLContext : public Context {
static bool debug_layer_support;
static bool texture_cube_map_array_support;
/** Workarounds. */
+ static bool debug_layer_workaround;
static bool texture_copy_workaround;
static bool unused_fb_slot_workaround;
static float derivative_signs[2];
diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc
index d505d8b4543..27b11c8125e 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -112,6 +112,7 @@ static void APIENTRY debug_callback(GLenum UNUSED(source),
#undef APIENTRY
+/* This function needs to be called once per context. */
void init_gl_callbacks(void)
{
char msg[256] = "";
@@ -145,7 +146,6 @@ void init_gl_callbacks(void)
else {
fprintf(stderr, "GPUDebug: Failed to hook OpenGL debug callback. Use fallback debug layer.\n");
init_debug_layer();
- GLContext::debug_layer_support = true;
}
}
diff --git a/source/blender/gpu/opengl/gl_debug.hh b/source/blender/gpu/opengl/gl_debug.hh
index 25595efebf6..8369a46f0e9 100644
--- a/source/blender/gpu/opengl/gl_debug.hh
+++ b/source/blender/gpu/opengl/gl_debug.hh
@@ -97,7 +97,7 @@ void init_debug_layer(void);
#define DEBUG_FUNC_OVERRIDE(func, ...) \
inline void func(ARG_LIST(__VA_ARGS__)) \
{ \
- if (GLContext::debug_layer_support) { \
+ if (GLContext::debug_layer_workaround) { \
debug::check_gl_error("generated before " #func); \
::func(ARG_LIST_CALL(__VA_ARGS__)); \
debug::check_gl_error("" #func); \
diff --git a/source/blender/gpu/opengl/gl_debug_layer.cc b/source/blender/gpu/opengl/gl_debug_layer.cc
index 81e49051e40..801cb9dbfbd 100644
--- a/source/blender/gpu/opengl/gl_debug_layer.cc
+++ b/source/blender/gpu/opengl/gl_debug_layer.cc
@@ -21,7 +21,7 @@
* \ingroup gpu
*
* Implement our own subset of KHR_debug extension.
- * We just wrap some functions
+ * We override the functions pointers by our own implementation that just checks glGetError.
*/
#include "BLI_utildefines.h"
@@ -51,13 +51,6 @@ typedef void *GPUvoidptr;
rtn_type##_ret; \
}
-#define DEBUG_FUNC_DUMMY(pfn, fn, ...) \
- pfn real_##fn; \
- static void GLAPIENTRY debug_##fn(ARG_LIST(__VA_ARGS__)) \
- { \
- UNUSED_VARS(ARG_LIST_CALL(__VA_ARGS__)); \
- }
-
namespace blender::gpu::debug {
/* List of wrapped functions. We dont have to support all of them.
@@ -108,12 +101,13 @@ DEBUG_FUNC_DECLARE(PFNGLTEXSUBIMAGE3DPROC, void, glTexSubImage3D, GLenum, target
DEBUG_FUNC_DECLARE(PFNGLTEXTUREBUFFERPROC, void, glTextureBuffer, GLuint, texture, GLenum, internalformat, GLuint, buffer);
DEBUG_FUNC_DECLARE(PFNGLUNMAPBUFFERPROC, GLboolean, glUnmapBuffer, GLenum, target);
DEBUG_FUNC_DECLARE(PFNGLUSEPROGRAMPROC, void, glUseProgram, GLuint, program);
-DEBUG_FUNC_DUMMY(PFNGLOBJECTLABELPROC, glObjectLabel, GLenum, identifier, GLuint, name, GLsizei, length, const GLchar *, label);
/* clang-format on */
#undef DEBUG_FUNC_DECLARE
-/* On some systems, */
+/* Init a fallback layer (to KHR_debug) that covers only some functions.
+ * We override the functions pointers by our own implementation that just checks glGetError.
+ * Some additional functions (not overridable) are covered inside the header using wrappers. */
void init_debug_layer(void)
{
#define DEBUG_WRAP(function) \
@@ -158,7 +152,6 @@ void init_debug_layer(void)
DEBUG_WRAP(glGenVertexArrays);
DEBUG_WRAP(glLinkProgram);
DEBUG_WRAP(glMapBufferRange);
- DEBUG_WRAP(glObjectLabel);
DEBUG_WRAP(glTexBuffer);
DEBUG_WRAP(glTexImage3D);
DEBUG_WRAP(glTexSubImage3D);