-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Implement shader uniform groups/subgroups #62972
Conversation
I noticed that within a group the uniforms are listed alphabetically, is that intended? |
It's not related to this PR, it's because uniforms originally placed to |
We should probably update the shader style guide to mention recommended casing: uniform_group SomeGroup {
// ...
} Or: uniform_group some_group {
// ...
} I'd go for snake_case personally, as the editor's automatic capitalization will probably do a better job with it. |
I'd prefer PascalCase as that way it doesn't look like a keyword edit: actually I guess it's not that bad with syntax highlighting |
I am definitely in favor of snake_case because many (myself included) are already used to the automatic capitalization Godot does with the uniform properties. |
I suggest something like: group_uniforms Something; // Something
group_uniforms Something.Subgroup; // Something/Subgroup
group_uniforms; // No group |
@reduz Do you mean that the grouped shader uniforms are between the group_uniforms statements? |
@reduz Alright - I did it as you said: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved in PR review meeting.
We're not all convinced by the implemented syntax, and some more discussion might be warranted to see what's the best syntax for this (taking into account that shaders don't have strings), but the feature implementation itself is good.
So we'll merge this now to have the feature and we can still change the syntax before 4.0 beta if we get a better suggestion.
Thanks! |
This PR is a follow up to godotengine#64092, which fixed important issues but it was implemented in an overly complex and inefficient way (because it forced the default code path to always go through string operations). This cleans up all the shader parameter code. This fixes godotengine#54336. Also fixes godotengine#56219 because, as the new code never queries the RenderingServer on load, potential deadlocks are avoided. **NOTE**: materials saved between godotengine#62972 and godotengine#64092 will no longer work and will need to be resaved in an earlier version.
This PR is a follow up to godotengine#64092, which fixed important issues but it was implemented in an overly complex and inefficient way (because it forced the default code path to always go through string operations). This cleans up all the shader parameter code. This fixes godotengine#54336. Also fixes godotengine#56219 because, as the new code never queries the RenderingServer on load, potential deadlocks are avoided. **NOTE**: materials saved between godotengine#62972 and godotengine#64092 will no longer work and will need to be resaved in an earlier version.
Can this be done in Visual Shaders already? (maybe I'm missing something) |
Implement uniform groups using syntax like:
Example screenshot:
Intended to close part of godotengine/godot-proposals#4827. If this is accepted I would like to try to implement them to visual shader to close it completly but not for now.