mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:52:57 +02:00
Merge pull request #998 from daleglass-overte/opengl-error-logging
Send OpenGL errors to log on debug builds
This commit is contained in:
commit
64e9be10ad
1 changed files with 22 additions and 2 deletions
|
@ -12,7 +12,9 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
#include "glad/glad.h"
|
||||||
Q_LOGGING_CATEGORY(gpugl45logging, "hifi.gpu.gl45")
|
Q_LOGGING_CATEGORY(gpugl45logging, "hifi.gpu.gl45")
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
@ -21,9 +23,27 @@ using namespace gpu::gl45;
|
||||||
GLint GL45Backend::MAX_COMBINED_SHADER_STORAGE_BLOCKS{ 0 };
|
GLint GL45Backend::MAX_COMBINED_SHADER_STORAGE_BLOCKS{ 0 };
|
||||||
GLint GL45Backend::MAX_UNIFORM_LOCATIONS{ 0 };
|
GLint GL45Backend::MAX_UNIFORM_LOCATIONS{ 0 };
|
||||||
|
|
||||||
|
#ifdef GLAD_DEBUG
|
||||||
|
static void post_call_callback_gl(const char *name, void *funcptr, int len_args, ...) {
|
||||||
|
(void)funcptr;
|
||||||
|
(void)len_args;
|
||||||
|
|
||||||
|
GLenum error_code = glad_glGetError();
|
||||||
|
if (error_code != GL_NO_ERROR) {
|
||||||
|
qCWarning(gpugl45logging) << "OpenGL error" << error_code << "in" << name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void staticInit() {
|
static void staticInit() {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
|
#ifdef GLAD_DEBUG
|
||||||
|
// This sets the post call callback to a logging function. By default it prints on
|
||||||
|
// stderr and skips our log. It only exists in debug builds.
|
||||||
|
glad_set_post_callback(&post_call_callback_gl);
|
||||||
|
#endif
|
||||||
glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, &GL45Backend::MAX_COMBINED_SHADER_STORAGE_BLOCKS);
|
glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, &GL45Backend::MAX_COMBINED_SHADER_STORAGE_BLOCKS);
|
||||||
glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &GL45Backend::MAX_UNIFORM_LOCATIONS);
|
glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &GL45Backend::MAX_UNIFORM_LOCATIONS);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue