[Mesa-dev] [PATCH 04/14] mesa: always return GL_OUT_OF_MEMORY or GL_NO_ERROR when KHR_no_error enabled

Timothy Arceri tarceri at itsqueeze.com
Wed Apr 19 00:37:21 UTC 2017


Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 src/mesa/main/getstring.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 6e90511..5da405d 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -297,17 +297,28 @@ invalid_pname:
  *
  * Returns __struct gl_contextRec::ErrorValue.
  */
 GLenum GLAPIENTRY
 _mesa_GetError( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    GLenum e = ctx->ErrorValue;
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
 
+   /* From Issue (3) of the KHR_no_error spec:
+    *
+    *    "Should glGetError() always return NO_ERROR or have undefined
+    *    results?
+    *
+    *    RESOLVED: It should for all errors except OUT_OF_MEMORY."
+    */
+   if (_mesa_is_no_error_enabled(ctx) && e != GL_OUT_OF_MEMORY) {
+      e = GL_NO_ERROR;
+   }
+
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_enum_to_string(e));
 
    ctx->ErrorValue = (GLenum) GL_NO_ERROR;
    ctx->ErrorDebugCount = 0;
    return e;
 }
-- 
2.9.3



More information about the mesa-dev mailing list