[Mesa-dev] [PATCH 1/5] darwin: Suppress type conversion warnings for GLhandleARB

Ian Romanick idr at freedesktop.org
Thu Jun 18 20:46:56 PDT 2015


On 06/17/2015 10:53 PM, Julien Isorce wrote:
> From: Jon TURNEY <jon.turney at dronecode.org.uk>
> 
> On darwin, GLhandleARB is defined as a void *, not the unsigned int it is on
> linux.
> 
> For the moment, apply a cast to supress the warning
> 
> Possibly this is safe, as for the mesa software renderer the shader program
> handle is not a real pointer, but a integer handle
> 
> Probably this is not the right thing to do, and we should pay closer attention
> to how the GLhandlerARB type is used.

In Mesa, glBindAttribLocation (which takes GLuint) and
glBindAttribLocationARB (which takes GLhandleARB) are *the same
function*.  The same applies to pretty much all the other GLhandleARB
functions.  Disentangling them would require an ABI break on Linux.
That just isn't going to happen...

...unless we decide to have a flag day and do a major amount of clean up
on the libGL <-> driver interface.  Before that is even contemplated, we
need to finish the rewrite / refactor of the glapi generator scripts and
get moved over to the Khronos XML.  Dylan has been working on this, but
I don't know how much progress he has made lately.

> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66346
> Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
> ---
>  src/mesa/main/shader_query.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index a6246a3..e3a1213 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -69,7 +69,7 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
>     GET_CURRENT_CONTEXT(ctx);
>  
>     struct gl_shader_program *const shProg =
> -      _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
> +      _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glBindAttribLocation");
>     if (!shProg)
>        return;
>  
> @@ -137,7 +137,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
>        return;
>     }
>  
> -   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
> +   shProg = _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glGetActiveAttrib");
>     if (!shProg)
>        return;
>  
> @@ -251,7 +251,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
>  {
>     GET_CURRENT_CONTEXT(ctx);
>     struct gl_shader_program *const shProg =
> -      _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
> +      _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glGetAttribLocation");
>  
>     if (!shProg) {
>        return -1;
> 



More information about the mesa-dev mailing list