[04/17] mesa: add semaphore parameter stub

Submitted by Andres Rodriguez on Nov. 2, 2017, 3:57 a.m.

Details

Message ID 20171102035720.6839-5-andresx7@gmail.com
State New
Headers show
Series "Add support for GL_EXT_semaphore" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez Nov. 2, 2017, 3:57 a.m.
EXT_semaphore and EXT_semaphore_fd define no pnames. Therefore there
isn't much to do besides determining the correct error code.

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

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 30f5248..93a92e9 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -696,12 +696,33 @@  _mesa_IsSemaphoreEXT(GLuint semaphore)
    return obj ? GL_TRUE : GL_FALSE;
 }
 
+/**
+ * Helper that outputs the correct error status for parameter
+ * calls where no pnames are defined
+ */
+static void
+semaphore_parameter_stub(const char* func, GLenum pname)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx->Extensions.EXT_semaphore) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
+      return;
+   }
+
+   /* EXT_semaphore and EXT_semaphore_fd define no parameters */
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
+   return;
+}
+
 void GLAPIENTRY
 _mesa_SemaphoreParameterui64vEXT(GLuint semaphore,
                                  GLenum pname,
                                  const GLuint64 *params)
 {
+   const char *func = "glSemaphoreParameterui64vEXT";
 
+   semaphore_parameter_stub(func, pname);
 }
 
 void GLAPIENTRY
@@ -709,7 +730,9 @@  _mesa_GetSemaphoreParameterui64vEXT(GLuint semaphore,
                                     GLenum pname,
                                     GLuint64 *params)
 {
+   const char *func = "glGetSemaphoreParameterui64vEXT";
 
+   semaphore_parameter_stub(func, pname);
 }
 
 void GLAPIENTRY

Comments

On Thu, Nov 2, 2017 at 4:57 AM, Andres Rodriguez <andresx7@gmail.com> wrote:
> EXT_semaphore and EXT_semaphore_fd define no pnames. Therefore there
> isn't much to do besides determining the correct error code.
>
> Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
> ---
>  src/mesa/main/externalobjects.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
> index 30f5248..93a92e9 100644
> --- a/src/mesa/main/externalobjects.c
> +++ b/src/mesa/main/externalobjects.c
> @@ -696,12 +696,33 @@ _mesa_IsSemaphoreEXT(GLuint semaphore)
>     return obj ? GL_TRUE : GL_FALSE;
>  }
>
> +/**
> + * Helper that outputs the correct error status for parameter
> + * calls where no pnames are defined
> + */
> +static void
> +semaphore_parameter_stub(const char* func, GLenum pname)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   if (!ctx->Extensions.EXT_semaphore) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
> +      return;
> +   }
> +
> +   /* EXT_semaphore and EXT_semaphore_fd define no parameters */
> +   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname);
> +   return;

Useless return;

Marek