Add the optional ability to print a stacktrace with an OpenGL error (closes #1700)

This commit is contained in:
Alexander Bock
2021-07-30 15:37:03 +02:00
parent 90157ce463
commit dfca605d63
5 changed files with 24 additions and 0 deletions

View File

@@ -74,6 +74,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/logging/visualstudiooutputlog.h>
#include <ghoul/misc/profiling.h>
#include <ghoul/misc/stacktrace.h>
#include <ghoul/misc/stringconversion.h>
#include <ghoul/opengl/debugcontext.h>
#include <ghoul/opengl/shaderpreprocessor.h>
@@ -560,6 +561,15 @@ void OpenSpaceEngine::initializeGL() {
default:
throw ghoul::MissingCaseException();
}
if (global::configuration->openGLDebugContext.printStacktrace) {
std::string stackString = "Stacktrace\n";
std::vector<std::string> stack = ghoul::stackTrace();
for (size_t i = 0; i < stack.size(); i++) {
stackString += fmt::format("{}: {}\n", i, stack[i]);
}
LDEBUGC(category, stackString);
}
};
ghoul::opengl::debug::setDebugCallback(callback);
}