[Mesa-dev] Patch for include/GL/gl.h

Brian Paul brian.e.paul at gmail.com
Sat Oct 26 16:56:29 CEST 2013


On Fri, Oct 25, 2013 at 10:02 AM, Baptist BENOIST <return_0 at live.com> wrote:
> Sorry for the weekly delay to answer, I am currently very busy.
>
>>> Hello,
>>>
>>> You can find attached a patch to apply on the include/GL/gl.h file.
>>>
>>> This patch aims to fix a build issue with GCC when using the
>>> -DGL_GLEXT_LEGACY, -Werror and -Wundef flags. I have remarked the problem
>>> with Qt 5.1.1 (which I am packaging for NixOS) but it will occur on any
>>> build which combines these three flags.
>>>
>>> To clarify things:
>>>
>>> -Wundef tells the compiler to warn on any use of an undefined definition
>>> (#define THE_DEFINITION).
>>> -Werror tells the compiler to transform any warning as an error.
>>>
>>> With these options, you cannot do:
>>>
>>> #if THE_DEFINITION
>>>
>>> when THE_DEFINITION has not been previously defined.
>>>
>>> You must do:
>>>
>>> #if defined(THE_DEFINITION) && THE_DEFINITION
>>>
>>>
>>> Feel free to ask me anything about this ;-)
>
>>>
>>> diff -rupN Mesa-9.2.0-orig/include/GL/gl.h Mesa-9.2.0/include/GL/gl.h
>>> --- Mesa-9.2.0-orig/include/GL/gl.h   2013-08-14 03:34:42.000000000 +0200
>>> +++ Mesa-9.2.0/include/GL/gl.h        2013-09-24 19:34:58.319140812 +0200
>>> @@ -2088,7 +2088,7 @@ typedef void (APIENTRYP PFNGLMULTITEXCOO
>>>
>>>
>>>
>>> -#if GL_ARB_shader_objects
>>> +#if defined(GL_ARB_shaders_objects) && GL_ARB_shader_objects
>>>
>>>  #ifndef GL_MESA_shader_debug
>>>  #define GL_MESA_shader_debug 1
>>
>> Actually, I think it could be safely changed to just
>>
>> #ifdef GL_ARB_shader_objects
>>
>> Would that be OK?
>
> As long as you are OK with the facts that defining GL_ARB_shader_objects to
> 0 will result to entering such a condition, it's also OK for me.
> In my patch, I only wanted to ensure a backward compatibility which even
> works with this uncommon case.
>
>> Going further, I think we could just remove all the
> GL_MESA_shader_debug stuff from Mesa.  It's an old extension that's
> never really been used.  I'll put it on my to-do list.
>
> As I rarely develop shaders, I cannot really  give you an interesting
> opinion about such a removal. As it seems that you already proceeded, let's
> see if someone really needed it ;-)
>
> Thanks for your answer and downstream-openness.


I removed the code in question from gl.h a few days ago.  Can you grab
the latest code from git and retest?

-Brian


More information about the mesa-dev mailing list