Skip to content
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

Fix using uint suffix at the hex number declaration in shaders #78906

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Jul 1, 2023

Fix #78800 by allowing using 'u' suffix with the hex number:

image

@Chaosus Chaosus requested a review from a team as a code owner July 1, 2023 11:29
@Chaosus Chaosus added this to the 4.2 milestone Jul 1, 2023
@Chaosus Chaosus changed the title Allow using uint suffix at the hex number declaration in shaders Fix using uint suffix at the hex number declaration in shaders Jul 1, 2023
@akien-mga akien-mga added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 1, 2023
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. tested locally as well and it appears to work great

@akien-mga akien-mga merged commit 25ec523 into godotengine:master Jul 7, 2023
@Chaosus Chaosus deleted the shader_allow_hex_uint branch July 7, 2023 07:32
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 10, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.1.

@AlfishSoftware
Copy link

This is a lexical change in *.gdshader(inc) grammar, right? I'll have to update it in my vscode extension grammar.
@Chaosus Does it allow only lowercase u or will 0xFFU be valid as well?


Btw, I didn't find any mention of hex constants at all in https://docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/shading_language.html#constants so when this is introduced, you might want to use the opportunity to add a little mention. E.g.:

Constants of the uint (unsigned int) type must have a u suffix to differentiate them from signed integers.
Alternatively, this can be done by using the uint(x) built-in conversion function.

uint a = 1u, b = uint(1);
uint c = 0xAu, d = uint(0xA);

@Chaosus
Copy link
Member Author

Chaosus commented Jul 18, 2023

Does it allow only lowercase u or will 0xFFU be valid as well?

Both, as well.

AlfishSoftware added a commit to AlfishSoftware/godot-files-vscode that referenced this pull request Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shader cannot use unsigned int suffix with hex
5 participants