-
Notifications
You must be signed in to change notification settings - Fork 276
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
Incorrect declaration of 64 bit static arrays #5458
Comments
You can use |
Note: the problem is that slang is incorrectly treating all int literals without suffix as signed 32-bit int. This is inconsistent with most other languages, where hexadecimal literals are always treated as unsigned int. Slang should do the same here. |
That is unexpected, thanks for the info |
I was working on a change to fix this, but the current documentation on 64 bit integers and integer literals explicitly states that any hexadecimal literals, even if they can't fit into a signed 32 bit integer, will be treated as one and that suffixes must always be used when specifying 64 bit integer literals. This looks like a language design choice and in this case the problem presented in the issue is not a real bug but a misuse of literals. @csyonghe When you said that this behavior should be fixed did you mean that it is okay to override and modify the current fundamental design of non-decimal integer literals? The |
This is not an intentional design. In general Slang should follow the same convention as in C++ unless there are strong arguments against it. This is definitely an oversight that we should fix. Thank you for contributing! |
I have found a very perplexing problem, which occurs when declaring a 64 bit global array as a bitmask.
This produces the following GLSL code:
In the GLSL output, the array has replaced the 32 bit masks with 64 bit masks. The problem persits when compiling with
emit-spirv-directly
and decompiling withspriv-cross
The text was updated successfully, but these errors were encountered: