[Mesa-dev] [PATCH] glsl: do not show locp information if it is not available

Juan A. Suarez Romero jasuarez at igalia.com
Fri Nov 4 12:10:59 UTC 2016


On Thu, 2016-11-03 at 12:23 -0700, Ian Romanick wrote:
> I'm also a little curious how we get to this point with locp being
> NULL.
>  Some commentary about that should at least go in the commit message.


So here is the reason.


Mesa initializes parser->version as 0. When finalizes parsing the
shader, if it didn't set explicitly the version it adds it implicitly.
Mesa knows it if parser->version != 0. As this code is added
implicitly, the locp in this case is NULL.

But the problem with this test is that user defines #version 0. So Mesa
doesn't realize version was set, and tries to implicitly adds the
version. But version was defined before, so it shows the error that
version is redefined. Problem? As said above, with the implicit code
locp is NULL, hence the error.


After thinking about it, I think this could be fixed if parser->version 
is initialized to a value that we know user can't set it. In this case,
initializing to -1. This would mean changing the parser->version type
to int instead of uint. But this is not a problem.


So I withdraw this patch and will submit a new one.


	J.A.



More information about the mesa-dev mailing list