13 #ifndef OGLPLUS_OPT_DEBUG_OUTPUT_1209031534_HPP
14 #define OGLPLUS_OPT_DEBUG_OUTPUT_1209031534_HPP
33 #include <oglplus/enums/debug_output_severity.ipp>
36 #if !OGLPLUS_NO_ENUM_VALUE_NAMES
37 #include <oglplus/enums/debug_output_severity_names.ipp>
40 #if !OGLPLUS_ENUM_VALUE_RANGES
41 #include <oglplus/enums/debug_output_severity_range.ipp>
50 #include <oglplus/enums/debug_output_source.ipp>
53 #if !OGLPLUS_NO_ENUM_VALUE_NAMES
54 #include <oglplus/enums/debug_output_source_names.ipp>
57 #if !OGLPLUS_ENUM_VALUE_RANGES
58 #include <oglplus/enums/debug_output_source_range.ipp>
66 #include <oglplus/enums/debug_output_type.ipp>
69 #if !OGLPLUS_NO_ENUM_VALUE_NAMES
70 #include <oglplus/enums/debug_output_type_names.ipp>
73 #if !OGLPLUS_ENUM_VALUE_RANGES
74 #include <oglplus/enums/debug_output_type_range.ipp>
78 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
108 OGLPLUS_GLFUNC(DebugMessageControl)(
113 enable ? GL_TRUE : GL_FALSE
115 OGLPLUS_VERIFY_SIMPLE(DebugMessageControl);
126 const GLchar* message;
130 typedef std::function<void (const CallbackData&)>
Callback;
147 static void GLAPIENTRY _gl_debug_proc(
153 const GLchar* message,
154 const GLvoid* user_param
166 data.length = length;
167 data.message = message;
168 self->_callback(data);
173 GLDEBUGPROC _prev_callback;
182 : _callback(callback)
183 , _prev_callback(nullptr)
184 , _prev_context(nullptr)
187 GLDEBUGPROC _tmp_callback =
nullptr;
189 reinterpret_cast<void**
>(&_tmp_callback);
190 OGLPLUS_GLFUNC(GetPointerv)(
191 GL_DEBUG_CALLBACK_FUNCTION,
194 OGLPLUS_VERIFY_SIMPLE(GetPointerv);
195 _prev_callback = _tmp_callback;
198 OGLPLUS_GLFUNC(GetPointerv)(
199 GL_DEBUG_CALLBACK_USER_PARAM,
202 OGLPLUS_VERIFY_SIMPLE(GetPointerv);
204 OGLPLUS_GLFUNC(DebugMessageCallback)(
205 &LogSink::_gl_debug_proc,
206 static_cast<void*
>(
this)
208 OGLPLUS_VERIFY_SIMPLE(DebugMessageCallback);
211 #if !OGLPLUS_NO_DELETED_FUNCTIONS
227 OGLPLUS_GLFUNC(DebugMessageCallback)(
231 OGLPLUS_VERIFY_SIMPLE(DebugMessageCallback);
247 const GLchar* message,
251 OGLPLUS_GLFUNC(PushDebugGroup)(
257 OGLPLUS_VERIFY_SIMPLE(PushDebugGroup);
273 OGLPLUS_GLFUNC(PushDebugGroup)(
279 OGLPLUS_VERIFY_SIMPLE(PushDebugGroup);
295 OGLPLUS_GLFUNC(PushDebugGroup)(
301 OGLPLUS_VERIFY_SIMPLE(PushDebugGroup);
304 #if !OGLPLUS_NO_DELETED_FUNCTIONS
319 OGLPLUS_GLFUNC(PopDebugGroup)();
320 OGLPLUS_VERIFY_SIMPLE(PopDebugGroup);
329 template <
typename ObjTag>
356 GL_DEBUG_OUTPUT_SYNCHRONOUS
358 OGLPLUS_VERIFY_SIMPLE(
Enable);
362 OGLPLUS_GLFUNC(Disable)(
363 GL_DEBUG_OUTPUT_SYNCHRONOUS
365 OGLPLUS_VERIFY_SIMPLE(Disable);
379 const GLchar* buffer,
383 OGLPLUS_GLFUNC(DebugMessageInsert)(
391 OGLPLUS_VERIFY_SIMPLE(DebugMessageInsert);
409 OGLPLUS_GLFUNC(DebugMessageInsert)(
417 OGLPLUS_VERIFY_SIMPLE(DebugMessageInsert);
435 OGLPLUS_GLFUNC(DebugMessageInsert)(
443 OGLPLUS_VERIFY_SIMPLE(DebugMessageInsert);
450 #endif // include guard
const Char * c_str(void) const
Returns the null-terminated c-string.
Definition: ref_tpl.hpp:200
Group(DebugOutputSource source, GLuint id, const String &message)
Pushes a debug group with the specified parameters.
Definition: debug_output.hpp:289
Pushes a group when constructed, pops in when destroyed.
Definition: debug_output.hpp:236
const_iterator begin(void) const
Returns iterator to the first character.
Definition: ref_tpl.hpp:170
Installs a custom callback processing the debug output.
Definition: debug_output.hpp:144
static void InsertMessage(DebugOutputSource source, DebugOutputType type, GLuint id, DebugOutputSeverity severity, const String &message)
Inserts a new message into the debug output.
Definition: debug_output.hpp:427
Group(DebugOutputSource source, GLuint id, StrCRef message)
Pushes a debug group with the specified parameters.
Definition: debug_output.hpp:267
Generic OpenGL object wrapper.
static void MessageControl(DebugOutputSource source, DebugOutputType type, DebugOutputSeverity severity, bool enable)
Enables/disables messages with specific parameters.
Definition: debug_output.hpp:101
Enumeration-related declarations.
static void Synchronous(bool enable)
Enables or disables synchronous debug output.
Definition: debug_output.hpp:351
std::function< void(const CallbackData &)> Callback
Type of a callback functor processing debug output.
Definition: debug_output.hpp:130
DebugOutputSeverity Severity
Debug output severity.
Definition: debug_output.hpp:87
DebugOutputSource
Debug output source enumeration.
Definition: debug_output.hpp:49
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
std::size_t size(void) const
Return the size (length) string.
Definition: ref_tpl.hpp:149
ObjectType
Enumeration of object types.
Definition: type.hpp:25
DebugOutputSource Source
Debug output source.
Definition: debug_output.hpp:90
static void ObjectLabel(const ObjectName< ObjTag > &object, StrCRef label)
Annotate object with the label with the specified length.
Definition: debug_output.hpp:330
static void InsertMessage(DebugOutputSource source, DebugOutputType type, GLuint id, DebugOutputSeverity severity, StrCRef message)
Inserts a new message into the debug output.
Definition: debug_output.hpp:401
String const reference wrapper template.
Definition: ref_tpl.hpp:72
Helper macro for optional checking of availability of GL function.
~LogSink(void)
Restores the previous callback and its context.
Definition: debug_output.hpp:225
DebugOutputSeverity
Debug output severity enumeration.
Definition: debug_output.hpp:32
Structure containing data passed to Callback functor.
Definition: debug_output.hpp:119
::std::basic_string< GLchar > String
String class.
Definition: def.hpp:36
LogSink(Callback callback)
Installs the callback and remembers the previous.
Definition: debug_output.hpp:181
DebugOutputType Type
Debug output type.
Definition: debug_output.hpp:93
DebugOutputType
Debug output type enumeration.
Definition: debug_output.hpp:65
static void InsertMessage(DebugOutputSource source, DebugOutputType type, GLuint id, DebugOutputSeverity severity, const GLchar *buffer, GLint length=-1)
Inserts a new message into the debug output.
Definition: debug_output.hpp:374
Wrapper for the GL debug output functionality.
Definition: debug_output.hpp:83
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136
Group(DebugOutputSource source, GLuint id, const GLchar *message, GLint length=-1)
Pushes a debug group with the specified parameters.
Definition: debug_output.hpp:244
~Group(void)
Pops a debug group with the specified parameters.
Definition: debug_output.hpp:317