diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
commit | f8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch) | |
tree | 26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/packer/pack_error.c | |
parent | Initial commit. (diff) | |
download | virtualbox-upstream.tar.xz virtualbox-upstream.zip |
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/packer/pack_error.c')
-rw-r--r-- | src/VBox/GuestHost/OpenGL/packer/pack_error.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_error.c b/src/VBox/GuestHost/OpenGL/packer/pack_error.c new file mode 100644 index 00000000..bb189c9a --- /dev/null +++ b/src/VBox/GuestHost/OpenGL/packer/pack_error.c @@ -0,0 +1,71 @@ +/* Copyright (c) 2001, Stanford University + * All rights reserved. + * + * See the file LICENSE.txt for information on redistributing this software. + */ + + +#include "cr_error.h" +#include "cr_environment.h" +#include "cr_pack.h" +#include "packer.h" + + +/* + * Set the error handler callback + */ +void crPackErrorFunction( CRPackContext *pc, CRPackErrorHandlerFunc function ) +{ + pc->Error = function; +} + + +/* + * This function is called by the packer functions when it detects and + * OpenGL error. + */ +void __PackError( int line, const char *file, GLenum error, const char *info) +{ + CR_GET_PACKER_CONTEXT(pc); + + if (pc->Error) + pc->Error( line, file, error, info ); + + if (crGetenv("CR_DEBUG")) + { + char *glerr; + + switch (error) { + case GL_NO_ERROR: + glerr = "GL_NO_ERROR"; + break; + case GL_INVALID_VALUE: + glerr = "GL_INVALID_VALUE"; + break; + case GL_INVALID_ENUM: + glerr = "GL_INVALID_ENUM"; + break; + case GL_INVALID_OPERATION: + glerr = "GL_INVALID_OPERATION"; + break; + case GL_STACK_OVERFLOW: + glerr = "GL_STACK_OVERFLOW"; + break; + case GL_STACK_UNDERFLOW: + glerr = "GL_STACK_UNDERFLOW"; + break; + case GL_OUT_OF_MEMORY: + glerr = "GL_OUT_OF_MEMORY"; + break; + case GL_TABLE_TOO_LARGE: + glerr = "GL_TABLE_TOO_LARGE"; + break; + default: + glerr = "unknown"; + break; + } + + crWarning( "GL error in packer: %s, line %d: %s: %s", + file, line, glerr, info ); + } +} |