-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arithmetic in macros only works with signed integers #2515
Comments
@devshgraphicsprogramming Can you please supply a sample shader that exhibits the problem? |
you can put it wherever in vertex shader, it doesn't work when it gets executed with |
When you say "explodes", do you mean "gives a large number of error messages but terminates cleanly"? Or do you mean "segfaults, crashes or otherwise terminates out of control"? I am seeing the following: ERROR: t4.frag:28: 'preprocessor evaluation' : bad expression |
Looking at the glslang source code and tests, it seems fairly clear that the implementers did not intend to support unsigned integer expressions in the preprocessor. So when the GLSL spec says that it supports "expressions operating on literal integer constants", I am presuming by "integer" the community has interpreted it as "int" or "signed integer". In other words, I do not consider this a case where the implementation is deficient of the specification. As such, it is not within my current charter to address this. Nonetheless if you or someone else wishes to add support for unsigned integer here, I am going to guess that no one would complain, and that no change in the spec would be necessary to allow it. If someone does intend to add this support, it might be good to check with a few others in the community first. So please check in with me first. As such I will close this issue for now. If indeed glslang is terminating uncleanly in the presence of uint constants, please reopen and I will address that issue. |
It would be good if we got an error saying "unsigned integer literal constant in preprocessor expression" instead of the cryptic
|
OK. I have re-opened with this latest request. |
@devshgraphicsprogramming Are you planning to make this improvement or shall I? |
You may also wish to open a request to update the GLSL spec to specify that |
I dont think I've ever touched that part of glslang |
This is not how I had interpreted the GLSL spec, but we should clarify whether it is intended to work or not. I'll create a GLSL issue to confirm what the spec intends and will clarify once it's confirmed. |
@devshgraphicsprogramming we discussed changing the GLSL spec to support unsigned, but it will likely take a while since it'll need CTS coverage and all implementations to support it. How urgent is this for you? I assume you can work-around the glslang issue in the meantime? |
dont worry I've already converted all my macros to use signed, so I can wait. |
Changing back to bug to address cryptic error message above. |
As soon as any contant has a
u
suffix the compiler "explodes"The text was updated successfully, but these errors were encountered: