[Bf-blender-cvs] [a9c05278b65] tmp-gldebuglayer: Add more debug functions to the GL debug layer
Clément Foucault
noreply at git.blender.org
Wed Sep 9 15:50:23 CEST 2020
Commit: a9c05278b654630e586af155d33f27ca77302817
Author: Clément Foucault
Date: Wed Sep 9 15:09:57 2020 +0200
Branches: tmp-gldebuglayer
https://developer.blender.org/rBa9c05278b654630e586af155d33f27ca77302817
Add more debug functions to the GL debug layer
===================================================================
M source/blender/gpu/opengl/gl_debug.cc
M source/blender/gpu/opengl/gl_debug.hh
M source/blender/gpu/opengl/gl_debug_layer.cc
===================================================================
diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc
index 11bd093bdce..d505d8b4543 100644
--- a/source/blender/gpu/opengl/gl_debug.cc
+++ b/source/blender/gpu/opengl/gl_debug.cc
@@ -116,6 +116,7 @@ void init_gl_callbacks(void)
{
char msg[256] = "";
const char format[] = "Successfully hooked OpenGL debug callback using %s";
+
if (GLEW_VERSION_4_3 || GLEW_KHR_debug) {
SNPRINTF(msg, format, GLEW_VERSION_4_3 ? "OpenGL 4.3" : "KHR_debug extension");
glEnable(GL_DEBUG_OUTPUT);
@@ -144,6 +145,7 @@ 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 2015a49bb07..537c034acf6 100644
--- a/source/blender/gpu/opengl/gl_debug.hh
+++ b/source/blender/gpu/opengl/gl_debug.hh
@@ -20,7 +20,9 @@
#pragma once
-#include "BKE_global.h"
+#include "gl_context.hh"
+
+#include "glew-mx.h"
namespace blender {
namespace gpu {
@@ -98,7 +100,7 @@ void init_debug_layer(void);
#define DEBUG_FUNC_OVERRIDE(func, ...) \
inline void func(ARG_LIST(__VA_ARGS__)) \
{ \
- if (G.debug & G_DEBUG_GPU) { \
+ if (GLContext::debug_layer_support) { \
debug::check_gl_error("generated before " #func); \
::func(ARG_LIST_CALL(__VA_ARGS__)); \
debug::check_gl_error("" #func); \
@@ -119,6 +121,12 @@ DEBUG_FUNC_OVERRIDE(glGenTextures, GLsizei, n, GLuint *, textures);
DEBUG_FUNC_OVERRIDE(glGetTexImage, GLenum, target, GLint, level, GLenum, format, GLenum, type, void *, pixels);
DEBUG_FUNC_OVERRIDE(glReadBuffer, GLenum, mode);
DEBUG_FUNC_OVERRIDE(glReadPixels, GLint, x, GLint, y, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, void *, pixels);
+DEBUG_FUNC_OVERRIDE(glTexImage1D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLint, border, GLenum, format, GLenum, type, const void *, pixels);
+DEBUG_FUNC_OVERRIDE(glTexImage2D, GLenum, target, GLint, level, GLint, internalformat, GLsizei, width, GLsizei, height, GLint, border, GLenum, format, GLenum, type, const void *, pixels);
+DEBUG_FUNC_OVERRIDE(glTexParameteri, GLenum, target, GLenum, pname, GLint, param);
+DEBUG_FUNC_OVERRIDE(glTexParameteriv, GLenum, target, GLenum, pname, const GLint *, params);
+DEBUG_FUNC_OVERRIDE(glTexSubImage1D, GLenum, target, GLint, level, GLint, xoffset, GLsizei, width, GLenum, format, GLenum, type, const void *, pixels);
+DEBUG_FUNC_OVERRIDE(glTexSubImage2D, GLenum, target, GLint, level, GLint, xoffset, GLint, yoffset, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, const void *, pixels);
/* clang-format on */
} // namespace gpu
diff --git a/source/blender/gpu/opengl/gl_debug_layer.cc b/source/blender/gpu/opengl/gl_debug_layer.cc
index 737fd58e2df..927caa4302a 100644
--- a/source/blender/gpu/opengl/gl_debug_layer.cc
+++ b/source/blender/gpu/opengl/gl_debug_layer.cc
@@ -105,6 +105,7 @@ DEBUG_FUNC_DECLARE(PFNGLMAPBUFFERRANGEPROC, GPUvoidptr, glMapBufferRange, GLenum
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_DECLARE(PFNGLTEXBUFFERPROC, void, glTexBuffer, GLenum, target, GLenum, internalFormat, GLuint, buffer);
DEBUG_FUNC_DUMMY(PFNGLOBJECTLABELPROC, glObjectLabel, GLenum, identifier, GLuint, name, GLsizei, length, const GLchar *, label);
/* clang-format on */
More information about the Bf-blender-cvs
mailing list