[2/3] mesa: minor tidy up for memory object error strings

Submitted by Andres Rodriguez on Nov. 11, 2017, 12:07 a.m.

Details

Message ID 20171111000724.20846-3-andresx7@gmail.com
State New
Headers show
Series "Minor tidy ups" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez Nov. 11, 2017, 12:07 a.m.
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
 src/mesa/main/externalobjects.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index e70280c..4e9f8f8 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -148,8 +148,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;
    }
 
@@ -195,9 +194,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;
    }
 
@@ -206,8 +206,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;
    }
 
@@ -224,8 +223,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
@@ -236,9 +234,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;
    }
 
@@ -259,8 +258,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 *
@@ -611,15 +609,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;
    }
 

Comments

On 11.11.2017 01:07, Andres Rodriguez wrote:
> Signed-off-by: Andres Rodriguez <andresx7@gmail.com>

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.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 e70280c..4e9f8f8 100644
> --- a/src/mesa/main/externalobjects.c
> +++ b/src/mesa/main/externalobjects.c
> @@ -148,8 +148,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;
>      }
>   
> @@ -195,9 +194,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;
>      }
>   
> @@ -206,8 +206,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;
>      }
>   
> @@ -224,8 +223,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
> @@ -236,9 +234,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;
>      }
>   
> @@ -259,8 +258,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 *
> @@ -611,15 +609,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;
>      }
>   
>