You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are a few logging utility functions that would be useful:
string format support
Allows formatting of string, automatically converting each member of variadic list to string. So only format character would be %s .
Example: LOG_W("Index: %s , Value: %s", idx, val)
Impl:
Assertions
Allows conditions to be held at either debug or release time.
Example usage:
void* data = glMapNamedBuffer(myBuffer, ...);
// Done during release, since it's inexpensive & the condition must hold
// for the following code to work
// The expression returns non-zero if the assertion failed
if (!LOG_RA(data, "Could not map buffer '%s'", myBuffer)) {
memcpy(data, someOtherData, 100);
glUnmapNamedBuffer(myBuffer);
}
std::view<size_t> sortedNodes = rootNode.GetSortedNodes();
// In this case, checking if the nodes are sorted is expensive & redundant in release.
// So this would only be checked in debug mode.
LOG_DA(IsSorted(sortedNodes), "Nodes are not sorted");
Modern OpenGL Debug Callback
Disable all of OSG's OpenGL error checkings.
for (auto& graphicsContext : allGraphicsContexts) {
graphicsContext
->getState()
->setCheckForGLErrors(osg::State::CheckForGLErrors::NEVER_CHECK_GL_ERRORS);
}
OSG uses the old OpenGL error checking (glGetError), which is a performance hit & gives little to no actual debugging value. Furthermore, it doesn't catch performance issues or warnings. Instead the modern OpenGL error checking should be implemented & toggled on/off as a runtime flag. https://www.khronos.org/opengl/wiki/Debug_Output . Should also allow to enable GL_DEBUG_OUTPUT_SYNCHRONOUS at runtime. With Back trace, this gives all the information necessary to track errors/warnings/performance issues & fix them immediately.
Back Trace
Allows the back trace to be emitted. Very useful for callbacks that can happen anywhere in the code. For example, with OpenGL Debug Callback, it does not describe which OpenGL function emitted the error. Printing backtrace solves this issue. Not sure how to implement this in Windows, but it's relatively simple to implement in Linux.
Pipe to locations other than files
Outputting to files is nice but it might be useful to allow users to output elsewhere. Big example is outputting out to a GUI. Could be as simple as allowing a user implementable callback, similar to how OpenGL Debug Callback works.
The text was updated successfully, but these errors were encountered:
Here are a few logging utility functions that would be useful:
string format support
Allows formatting of string, automatically converting each member of variadic list to string. So only format character would be %s .
Example:
LOG_W("Index: %s , Value: %s", idx, val)
Impl:
Assertions
Allows conditions to be held at either debug or release time.
Example usage:
Modern OpenGL Debug Callback
Disable all of OSG's OpenGL error checkings.
OSG uses the old OpenGL error checking (glGetError), which is a performance hit & gives little to no actual debugging value. Furthermore, it doesn't catch performance issues or warnings. Instead the modern OpenGL error checking should be implemented & toggled on/off as a runtime flag. https://www.khronos.org/opengl/wiki/Debug_Output . Should also allow to enable GL_DEBUG_OUTPUT_SYNCHRONOUS at runtime. With Back trace, this gives all the information necessary to track errors/warnings/performance issues & fix them immediately.
Back Trace
Allows the back trace to be emitted. Very useful for callbacks that can happen anywhere in the code. For example, with OpenGL Debug Callback, it does not describe which OpenGL function emitted the error. Printing backtrace solves this issue. Not sure how to implement this in Windows, but it's relatively simple to implement in Linux.
Pipe to locations other than files
Outputting to files is nice but it might be useful to allow users to output elsewhere. Big example is outputting out to a GUI. Could be as simple as allowing a user implementable callback, similar to how OpenGL Debug Callback works.
The text was updated successfully, but these errors were encountered: