mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Added tech ENABLE_OPENGL_ERROR_LOGGING -> log opengl errors when SLIC3R_LOGLEVEL=5
This commit is contained in:
parent
6f4d24ab95
commit
ad7e7ae1cd
3 changed files with 37 additions and 0 deletions
|
@ -39,6 +39,32 @@
|
|||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#if ENABLE_OPENGL_ERROR_LOGGING
|
||||
void glAssertRecentCallImpl(const char* file_name, unsigned int line, const char* function_name)
|
||||
{
|
||||
#if NDEBUG
|
||||
if (Slic3r::get_logging_level() < 5)
|
||||
return;
|
||||
#endif // NDEBUG
|
||||
|
||||
GLenum err = glGetError();
|
||||
if (err == GL_NO_ERROR)
|
||||
return;
|
||||
const char* sErr = 0;
|
||||
switch (err) {
|
||||
case GL_INVALID_ENUM: sErr = "Invalid Enum"; break;
|
||||
case GL_INVALID_VALUE: sErr = "Invalid Value"; break;
|
||||
// be aware that GL_INVALID_OPERATION is generated if glGetError is executed between the execution of glBegin and the corresponding execution of glEnd
|
||||
case GL_INVALID_OPERATION: sErr = "Invalid Operation"; break;
|
||||
case GL_STACK_OVERFLOW: sErr = "Stack Overflow"; break;
|
||||
case GL_STACK_UNDERFLOW: sErr = "Stack Underflow"; break;
|
||||
case GL_OUT_OF_MEMORY: sErr = "Out Of Memory"; break;
|
||||
default: sErr = "Unknown"; break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(error) << "OpenGL error in " << file_name << ":" << line << ", function " << function_name << "() : " << (int)err << " - " << sErr;
|
||||
assert(false);
|
||||
}
|
||||
#else
|
||||
#ifdef HAS_GLSAFE
|
||||
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
|
||||
{
|
||||
|
@ -60,6 +86,7 @@ void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char
|
|||
assert(false);
|
||||
}
|
||||
#endif
|
||||
#endif // ENABLE_OPENGL_ERROR_LOGGING
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue