[Mesa-dev] [PATCH 10/17] mesa: minor tidy up for memory object error strings

Andres Rodriguez andresx7 at gmail.com
Thu Nov 2 03:57:13 UTC 2017


Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
---
 src/mesa/main/externalobjects.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index b82d425..67912dd 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -149,8 +149,7 @@ _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
       _mesa_debug(ctx, "%s(%d, %p)", func, n, memoryObjects);
 
    if (!ctx->Extensions.EXT_memory_object) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glCreateMemoryObjectsEXT(unsupported)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
       return;
    }
 
@@ -196,9 +195,10 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject,
    GET_CURRENT_CONTEXT(ctx);
    struct gl_memory_object *memObj;
 
+   const char *func = "glMemoryObjectParameterivEXT";
+
    if (!ctx->Extensions.EXT_memory_object) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glMemoryObjectParameterivEXT(unsupported)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
       return;
    }
 
@@ -207,8 +207,7 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject,
       return;
 
    if (memObj->Immutable) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glMemoryObjectParameterivEXT(memoryObject is immutable");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(memoryObject is immutable", func);
       return;
    }
 
@@ -225,8 +224,7 @@ _mesa_MemoryObjectParameterivEXT(GLuint memoryObject,
    return;
 
 invalid_pname:
-   _mesa_error(ctx, GL_INVALID_ENUM,
-               "glMemoryObjectParameterivEXT(pname=0x%x)", pname);
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
 }
 
 void GLAPIENTRY
@@ -237,9 +235,10 @@ _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject,
    GET_CURRENT_CONTEXT(ctx);
    struct gl_memory_object *memObj;
 
+   const char *func = "glMemoryObjectParameterivEXT";
+
    if (!ctx->Extensions.EXT_memory_object) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetMemoryObjectParameterivEXT(unsupported)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
       return;
    }
 
@@ -260,8 +259,7 @@ _mesa_GetMemoryObjectParameterivEXT(GLuint memoryObject,
    return;
 
 invalid_pname:
-   _mesa_error(ctx, GL_INVALID_ENUM,
-               "glGetMemoryObjectParameterivEXT(pname=0x%x)", pname);
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
 }
 
 static struct gl_memory_object *
@@ -797,15 +795,15 @@ _mesa_ImportMemoryFdEXT(GLuint memory,
 {
    GET_CURRENT_CONTEXT(ctx);
 
+   const char *func = "glImportMemoryFdEXT";
+
    if (!ctx->Extensions.EXT_memory_object_fd) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glImportMemoryFdEXT(unsupported)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
       return;
    }
 
    if (handleType != GL_HANDLE_TYPE_OPAQUE_FD_EXT) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glImportMemoryFdEXT(handleType=%u)",
-                  handleType);
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(handleType=%u)", func, handleType);
       return;
    }
 
-- 
2.9.3



More information about the mesa-dev mailing list