[Mesa-dev] [PATCH 0/2] Allow redeclaration of GLSL builtins; fixes Dying Light and Dead Island Definitive Edition

Ian Romanick idr at freedesktop.org
Mon May 15 22:04:07 UTC 2017


On 05/12/2017 06:39 AM, John Brooks wrote:
> Since release, Dying Light and Dead Island Definitive Edition have been broken
> on Mesa, producing at best only a black screen after loading. I found that the
> root of the problem is that their vertex shaders redeclare the GLSL builtin
> gl_VertexID, which Mesa's compiler considers to be an error:
> 
>     error: `gl_VertexID' redeclared

Sorry for not responding to this sooner.  I've been away for the last
few weeks.

I believe that we enforce this as the result of a conformance test that
does almost exactly this thing.  We didn't used to enforce it, but after
discussion with Khronos (which I can dig up), we began enforcing it.
This also led to a clarification in the GLSL spec.  Section 3.7
(Identifiers) of the GLSL 4.50 spec says:

   However, as noted in the specification, there are some cases where
   previously declared variables can be redeclared, and predeclared
   "gl_" names are allowed to be redeclared in a shader only for these
   specific purposes. More generally, it is a compile-time error to
   redeclare a variable, including those starting “gl_”.

Redeclaring gl_VertexID is clearly a bug in the game.  Has anyone
reported this to them?



More information about the mesa-dev mailing list