summaryrefslogtreecommitdiff
path: root/gfx/gl/gldebug.cpp
blob: 518d4fbaa661ba3f45d85f64fccb81548752b449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#if GLDEBUG == 2
// Level 2 is out of line because its "complex"

#	include "gldebug.h"
#	include <format>

glDebugScope::glDebugScope(GLuint id, const std::source_location & location)
{
	const auto fullMsg = std::format("{} ({}:{})", location.function_name(), location.file_name(), location.line());
	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, id, static_cast<GLsizei>(fullMsg.length()), fullMsg.c_str());
}

glDebugScope::glDebugScope(GLuint id, const std::string_view msg, const std::source_location & location)
{
	const auto fullMsg
			= std::format("{} @ {} ({}:{})", msg, location.function_name(), location.file_name(), location.line());
	glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, id, static_cast<GLsizei>(fullMsg.length()), fullMsg.c_str());
}

#endif