<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 19 June 2015 at 10:24, Jose Fonseca <span dir="ltr"><<a href="mailto:jfonseca@vmware.com" target="_blank">jfonseca@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 19/06/15 04:46, Ian Romanick wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 06/17/2015 10:53 PM, Julien Isorce wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
From: Jon TURNEY <<a href="mailto:jon.turney@dronecode.org.uk" target="_blank">jon.turney@dronecode.org.uk</a>><br>
<br>
On darwin, GLhandleARB is defined as a void *, not the unsigned int it is on<br>
linux.<br>
<br>
For the moment, apply a cast to supress the warning<br>
<br>
Possibly this is safe, as for the mesa software renderer the shader program<br>
handle is not a real pointer, but a integer handle<br>
<br>
Probably this is not the right thing to do, and we should pay closer attention<br>
to how the GLhandlerARB type is used.<br>
</blockquote>
<br>
In Mesa, glBindAttribLocation (which takes GLuint) and<br>
glBindAttribLocationARB (which takes GLhandleARB) are *the same<br>
function*. The same applies to pretty much all the other GLhandleARB<br>
functions.<br>
</blockquote>
<br>
<br></span>
Properly fixing this is a nightmare, but I think that short term workaround is feasible.<br>
<br>
This is the generated glapitemp.h:<br>
<br>
KEYWORD1 void KEYWORD2 NAME(BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB * name)<br>
{<br>
(void) program; (void) index; (void) name;<br>
DISPATCH(BindAttribLocation, (program, index, name), (F, "glBindAttribLocationARB(%d, %d, %p);\n", program, index, (const void *) name));<br>
}<br>
<br>
Provided that GLhandlerARB is defined as `unsigned long` during Mesa build on MacOSX</blockquote><div><br></div><div>Hi, where exactly ? or do you mean we just need to apply the patch [1] you pointed ?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> (to avoid these int<->void *) conversions [1], the compiler should implicitly cast the 64bits GLhandlerARB program to an 32-bits GLuint.<br>
<br>
So, when an app calls glBindAttribLocationARB it will be dispatched to _mesa_BindAttribLocation, and the program truncated. So it should all just work.<br>
<br>
Ditto for when GLhandleARB appears as return value.<br>
<br>
<br>
The only problem is when GLhandleARB appears as a pointer, as there is only one such instance:<br>
<br>
GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);<br>
<br>
But we do have a separate entry-point for this (_mesa_GetAttachedObjectsARB) so again, we're all good.<br>
<br>
<br>
So, Jon/Julien's patch seems perfectly workable -- all really left to do is to silence GLhandleARB <-> GLuint conversions.<br></blockquote><div><br></div><div>That's a good news.</div><div>So Jose concretely what needs to be done ? Just apply the patch [1] you pointed or apply cast everywhere ?</div><div>
<p class=""><span class="">All conversions are in the 3 files, </span><span class="">src/mesa/main/dlist.c, </span>src/mesa/main/shaderapi.c and src/mesa/main/shader_query.cpp, am I right ?</p><p class="">I did not notice before, but without any change on upstream code, it gives an error only when compiling c++ files. For c files it is a warning: <br></p>
</div><div>
<p class=""><span class="">main/shaderapi.<b>c</b>:1148:23: </span><span class="">warning: </span><span class="">incompatible pointer to integer conversion passing 'GLhandleARB' (aka 'void *') to parameter of type 'GLuint' (aka 'unsigned int') [-Wint-conversion] </span>attach_shader(ctx, program, shader);</p><p class=""><span class="">main/shader_query.<b>cpp</b>:72:7: </span><span class="">error: </span><span class="">no matching function for call to '_mesa_lookup_shader_program_err'<b> </b></span><span class="">"glBindAttribLocation");</span><span class="">../../src/mesa/main/shaderobj.h:89:1: note: candidate function not viable: cannot convert argument of incomplete type 'GLhandleARB' (aka 'void *') to 'GLuint' (aka 'unsigned int')</span>_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,</p><p class="">Thx <br></p></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
Jose<br>
<br>
<br>
[1] Apitrace also defines GLhandleARB as unsigned long internally to avoid this <a href="https://github.com/apitrace/apitrace/blob/master/thirdparty/khronos/GL/glext.patch" rel="noreferrer" target="_blank">https://github.com/apitrace/apitrace/blob/master/thirdparty/khronos/GL/glext.patch</a><br>
<br>
</blockquote></div><br></div></div>