]> git.sesse.net Git - casparcg/blobdiff - common/gl/gl_check.cpp
[logging] Suppress the logging of full path names in stack traces so that only the...
[casparcg] / common / gl / gl_check.cpp
index 2ff4642d86299c306b5b1bad843fd5d76d268b1f..72b12306108ce709447236ace93f47959fcadfbb 100644 (file)
@@ -30,9 +30,9 @@
 
 #include <GL/glew.h>
 
-namespace caspar { namespace gl {      
+namespace caspar { namespace gl {
 
-void SMFL_GLCheckError(const std::string&, const std::string& file, unsigned int line)
+void SMFL_GLCheckError(const std::string&, const char* func, const char* file, unsigned int line)
 {
        // Get the last error
        GLenum LastErrorCode = GL_NO_ERROR;
@@ -49,53 +49,67 @@ void SMFL_GLCheckError(const std::string&, const std::string& file, unsigned int
                switch (LastErrorCode)
                {
                        case GL_INVALID_ENUM :
-                               CASPAR_THROW_EXCEPTION(ogl_invalid_enum()
-                                       << msg_info("an unacceptable value has been specified for an enumerated argument")
-                                       << error_info("GL_INVALID_ENUM")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_invalid_enum()
+                                               << msg_info("an unacceptable value has been specified for an enumerated argument")
+                                               << error_info("GL_INVALID_ENUM")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_INVALID_VALUE :
-                               CASPAR_THROW_EXCEPTION(ogl_invalid_value()
-                                       << msg_info("a numeric argument is out of range")
-                                       << error_info("GL_INVALID_VALUE")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_invalid_value()
+                                               << msg_info("a numeric argument is out of range")
+                                               << error_info("GL_INVALID_VALUE")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_INVALID_OPERATION :
-                               CASPAR_THROW_EXCEPTION(ogl_invalid_operation()
-                                       << msg_info("the specified operation is not allowed in the current state")
-                                       << error_info("GL_INVALID_OPERATION")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_invalid_operation()
+                                               << msg_info("the specified operation is not allowed in the current state")
+                                               << error_info("GL_INVALID_OPERATION")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_STACK_OVERFLOW :
-                               CASPAR_THROW_EXCEPTION(ogl_stack_overflow()
-                                       << msg_info("this command would cause a stack overflow")
-                                       << error_info("GL_STACK_OVERFLOW")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_stack_overflow()
+                                               << msg_info("this command would cause a stack overflow")
+                                               << error_info("GL_STACK_OVERFLOW")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_STACK_UNDERFLOW :
-                               CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
-                                       << msg_info("this command would cause a stack underflow")
-                                       << error_info("GL_STACK_UNDERFLOW")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_stack_underflow()
+                                               << msg_info("this command would cause a stack underflow")
+                                               << error_info("GL_STACK_UNDERFLOW")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_OUT_OF_MEMORY :
-                               CASPAR_THROW_EXCEPTION(ogl_out_of_memory()
-                                       << msg_info("there is not enough memory left to execute the command")
-                                       << error_info("GL_OUT_OF_MEMORY")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_out_of_memory()
+                                               << msg_info("there is not enough memory left to execute the command")
+                                               << error_info("GL_OUT_OF_MEMORY")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
 
                        case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :
-                               CASPAR_THROW_EXCEPTION(ogl_stack_underflow()
-                                       << msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
-                                       << error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")
-                                       << line_info(line)
-                                       << source_info(file));
+                               ::boost::exception_detail::throw_exception_(
+                                       ogl_invalid_framebuffer_operation_ext()
+                                               << msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
+                                               << error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")
+                                               << call_stack_info(caspar::get_call_stack())
+                                               << context_info(get_context()),
+                                       func, log::remove_source_prefix(file), line);
                }
        }
 }