From a42220a035606fc916be421bec5b51445255198d Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 3 May 2019 12:27:21 +0100 Subject: [PATCH] Add helpers to set/push/pop markers on GL --- util/test/demos/gl/gl_test.cpp | 19 +++++++++++++++++++ util/test/demos/gl/gl_test.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/util/test/demos/gl/gl_test.cpp b/util/test/demos/gl/gl_test.cpp index 308dcacd1..802a74399 100644 --- a/util/test/demos/gl/gl_test.cpp +++ b/util/test/demos/gl/gl_test.cpp @@ -212,6 +212,25 @@ GLuint OpenGLGraphicsTest::MakeFBO() return fbos[fbos.size() - 1]; } +void OpenGLGraphicsTest::pushMarker(const std::string &name) +{ + if(glPushDebugGroup) + glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, name.c_str()); +} + +void OpenGLGraphicsTest::setMarker(const std::string &name) +{ + if(glDebugMessageInsert) + glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0, + GL_DEBUG_SEVERITY_LOW, -1, name.c_str()); +} + +void OpenGLGraphicsTest::popMarker() +{ + if(glPopDebugGroup) + glPopDebugGroup(); +} + bool OpenGLGraphicsTest::Running() { if(!FrameLimit()) diff --git a/util/test/demos/gl/gl_test.h b/util/test/demos/gl/gl_test.h index 293331a67..72c75af73 100644 --- a/util/test/demos/gl/gl_test.h +++ b/util/test/demos/gl/gl_test.h @@ -52,6 +52,10 @@ struct OpenGLGraphicsTest : public GraphicsTest GLuint MakeVAO(); GLuint MakeFBO(); + void pushMarker(const std::string &name); + void setMarker(const std::string &name); + void popMarker(); + bool Running(); void Present(GraphicsWindow *window); void Present() { Present(mainWindow); }