From: Lawrence S. <ljs...@us...> - 2016-01-04 03:25:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 0fa6e42b5575d3c10980bfebf8581d51523fef6e (commit) via 9fc75b677213215b47c112f415c4c7719097c5c4 (commit) from dd765f80d6657f9d42558019a9a721a98904dae0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0fa6e42b5575d3c10980bfebf8581d51523fef6e Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 3 22:24:52 2016 -0500 Remove +x permissions bits... commit 9fc75b677213215b47c112f415c4c7719097c5c4 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 3 22:23:32 2016 -0500 Add glGetError() and gluErrorString(). ----------------------------------------------------------------------- Summary of changes: gl-error.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- include/gl.h | 5 ++++- include/glu.h | 3 +++ 3 files changed, 53 insertions(+), 2 deletions(-) mode change 100755 => 100644 Makefile mode change 100755 => 100644 gl-api.c mode change 100755 => 100644 gl-api.h mode change 100755 => 100644 gl-arrays.c mode change 100755 => 100644 gl-arrays.h mode change 100755 => 100644 gl-cap.c mode change 100755 => 100644 gl-clip-arrays.c mode change 100755 => 100644 gl-clip.c mode change 100755 => 100644 gl-clip.h mode change 100755 => 100644 gl-error.c mode change 100755 => 100644 gl-fog.c mode change 100755 => 100644 gl-framebuffer.c mode change 100755 => 100644 gl-light.c mode change 100755 => 100644 gl-light.h mode change 100755 => 100644 gl-matrix.c mode change 100755 => 100644 gl-pvr.c mode change 100755 => 100644 gl-pvr.h mode change 100755 => 100644 gl-rgb.c mode change 100755 => 100644 gl-rgb.h mode change 100755 => 100644 gl-sh4-light.S mode change 100755 => 100644 gl-sh4.h mode change 100755 => 100644 gl-texture.c mode change 100755 => 100644 glu-texture.c mode change 100755 => 100644 include/gl.h mode change 100755 => 100644 include/glext.h mode change 100755 => 100644 include/glu.h mode change 100755 => 100644 include/glut.h mode change 100755 => 100644 kos/dreamcast.cnf diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/gl-api.c b/gl-api.c old mode 100755 new mode 100644 diff --git a/gl-api.h b/gl-api.h old mode 100755 new mode 100644 diff --git a/gl-arrays.c b/gl-arrays.c old mode 100755 new mode 100644 diff --git a/gl-arrays.h b/gl-arrays.h old mode 100755 new mode 100644 diff --git a/gl-cap.c b/gl-cap.c old mode 100755 new mode 100644 diff --git a/gl-clip-arrays.c b/gl-clip-arrays.c old mode 100755 new mode 100644 diff --git a/gl-clip.c b/gl-clip.c old mode 100755 new mode 100644 diff --git a/gl-clip.h b/gl-clip.h old mode 100755 new mode 100644 diff --git a/gl-error.c b/gl-error.c old mode 100755 new mode 100644 index d047653..ba487ec --- a/gl-error.c +++ b/gl-error.c @@ -2,6 +2,7 @@ libgl/gl-error.c Copyright (C) 2014 Josh Pearson + Copyright (C) 2016 Lawrence Sebald KOS Open GL State Machine Error Code Implementation. */ @@ -17,12 +18,27 @@ #define KOS_GL_INVALID_VALUE (1<<3) static GLsizei KOS_GL_ERROR_CODE; +static GLenum gl_last_error = GL_NO_ERROR; static char KOS_GL_ERROR_FUNCTION[64] = { '\0' }; +/* Quoth the GL Spec: + When an error occurs, the error flag is set to the appropriate error code + value. No other errors are recorded until glGetError is called, the error + code is returned, and the flag is reset to GL_NO_ERROR. + + So, we only record an error here if the error code is currently unset. + Nothing in the spec requires recording multiple error flags, although it is + allowed by the spec. We take the easy way out for now. */ +static void set_err_flag(GLenum error) { + if(gl_last_error == GL_NO_ERROR) + gl_last_error = error; +} + void _glKosThrowError(GLenum error, char *function) { sprintf(KOS_GL_ERROR_FUNCTION, "%s\n", function); + set_err_flag(error); switch(error) { case GL_INVALID_ENUM: @@ -69,4 +85,33 @@ void _glKosPrintError() { printf("KOS GL ERROR: GL_INVALID_VALUE\n"); _glKosResetError(); -} \ No newline at end of file +} + +GLenum glGetError(void) { + GLenum rv = gl_last_error; + + gl_last_error = GL_NO_ERROR; + return rv; +} + +const GLubyte *gluErrorString(GLenum error) { + switch(error) { + case GL_NO_ERROR: + return (GLubyte *)"no error"; + + case GL_INVALID_ENUM: + return (GLubyte *)"invalid enumerant"; + + case GL_INVALID_OPERATION: + return (GLubyte *)"invalid operation"; + + case GL_INVALID_VALUE: + return (GLubyte *)"invalid value"; + + case GL_OUT_OF_MEMORY: + return (GLubyte *)"out of memory"; + + default: + return (GLubyte *)"unknown error"; + } +} diff --git a/gl-fog.c b/gl-fog.c old mode 100755 new mode 100644 diff --git a/gl-framebuffer.c b/gl-framebuffer.c old mode 100755 new mode 100644 diff --git a/gl-light.c b/gl-light.c old mode 100755 new mode 100644 diff --git a/gl-light.h b/gl-light.h old mode 100755 new mode 100644 diff --git a/gl-matrix.c b/gl-matrix.c old mode 100755 new mode 100644 diff --git a/gl-pvr.c b/gl-pvr.c old mode 100755 new mode 100644 diff --git a/gl-pvr.h b/gl-pvr.h old mode 100755 new mode 100644 diff --git a/gl-rgb.c b/gl-rgb.c old mode 100755 new mode 100644 diff --git a/gl-rgb.h b/gl-rgb.h old mode 100755 new mode 100644 diff --git a/gl-sh4-light.S b/gl-sh4-light.S old mode 100755 new mode 100644 diff --git a/gl-sh4.h b/gl-sh4.h old mode 100755 new mode 100644 diff --git a/gl-texture.c b/gl-texture.c old mode 100755 new mode 100644 diff --git a/glu-texture.c b/glu-texture.c old mode 100755 new mode 100644 diff --git a/include/gl.h b/include/gl.h old mode 100755 new mode 100644 index c57476e..9808254 --- a/include/gl.h +++ b/include/gl.h @@ -2,7 +2,7 @@ libgl/gl.h Copyright (C) 2013-2014 Josh "PH3NOM" Pearson - Copyright (C) 2014 Lawrence Sebald + Copyright (C) 2014, 2016 Lawrence Sebald Some functionality adapted from the original KOS libgl: Copyright (C) 2001 Dan Potter @@ -659,6 +659,9 @@ GLAPI void APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); GLAPI GLenum APIENTRY glCheckFramebufferStatus(GLenum target); +/* Error handling */ +GLAPI GLenum APIENTRY glGetError(void); + /* Non Operational Stubs for portability */ GLAPI void APIENTRY glAlphaFunc(GLenum func, GLclampf ref); GLAPI void APIENTRY glLineWidth(GLfloat width); diff --git a/include/glext.h b/include/glext.h old mode 100755 new mode 100644 diff --git a/include/glu.h b/include/glu.h old mode 100755 new mode 100644 index dcb89f2..6397441 --- a/include/glu.h +++ b/include/glu.h @@ -2,6 +2,7 @@ libgl/glu.h Copyright (C) 2013-2014 Josh "PH3NOM" Pearson + Copyright (C) 2016 Lawrence Sebald Some functionality adapted from the original KOS libgl: Copyright (C) 2001 Dan Potter @@ -42,6 +43,8 @@ GLAPI void APIENTRY glhLookAtf2(GLfloat *eyePosition3D, GLfloat *center3D, GLfloat *upVector3D); +GLAPI const GLubyte* APIENTRY gluErrorString(GLenum error); + __END_DECLS #endif /* !__GL_GLU_H */ diff --git a/include/glut.h b/include/glut.h old mode 100755 new mode 100644 diff --git a/kos/dreamcast.cnf b/kos/dreamcast.cnf old mode 100755 new mode 100644 hooks/post-receive -- The KallistiOS port of OpenGL. |