diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-03 02:09:03 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-12-03 02:09:03 +0000 |
commit | c64d8d836bc48a9aedf4cb57e480a4227936011c (patch) | |
tree | 22c997e5517275451204fd5effff9123733b554e /test | |
parent | Check error state during setup, set OpenGL version to 3.3 core (diff) | |
download | ilt-c64d8d836bc48a9aedf4cb57e480a4227936011c.tar.bz2 ilt-c64d8d836bc48a9aedf4cb57e480a4227936011c.tar.xz ilt-c64d8d836bc48a9aedf4cb57e480a4227936011c.zip |
Add GL_DEBUG_OUTPUT with boost test error handling to test-render context
Diffstat (limited to 'test')
-rw-r--r-- | test/test-render.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp index 5a75419..17bc5fc 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -48,7 +48,27 @@ class TestMainWindow : public Window { // This exists only to hold an OpenGL context open for the duration of the tests, // in the same way a real main window would always exist. public: - TestMainWindow() : Window {1, 1, __FILE__, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN} { } + TestMainWindow() : Window {1, 1, __FILE__, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN} + { + glEnable(GL_DEBUG_OUTPUT); + glDebugMessageCallback( + [](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, + const void *) { + char buf[BUFSIZ]; + snprintf(buf, BUFSIZ, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s", + (type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message); + switch (type) { + case GL_DEBUG_TYPE_ERROR: + case GL_DEBUG_TYPE_PERFORMANCE: + case GL_DEBUG_TYPE_PORTABILITY: + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + BOOST_TEST_ERROR(buf); + } + BOOST_TEST_MESSAGE(buf); + }, + nullptr); + } void tick(TickDuration) override { |