-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Added constants PI, TAU and E to the shader language #48837
Conversation
Yep, checked, seems worked correctly. Thanks for your first contribution to Godot Engine! These constants are really useful. |
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.
A couple thoughts
- It may be easier to just define the constants in the .cpp files with actions.rename
- You shouldn't define the extra constants in shaders that don't use them. For example, cubemap roughness and cubemap down sampler do not use TAU or E. So there is no need to touch them.
servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
Outdated
Show resolved
Hide resolved
Note that once this is ready, we'll ask you to squash the commits into one before this is merged. See PR workflow on instructions on how to rebase/squash commits in your branch. |
520f5a4
to
2013d31
Compare
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.
Implementation looks fine to me, but I question why we are just throwing a bunch of constants into the shader code without considering need.
For example, where would LN2
be useful? I don't even know what constant it represents. And it appears it is only used once in the entire Godot codebase.
They just happened to be defined in the same file as PI and TAU. I guess they aren't necessary as long as the shader compiler is smart enough to compute ln(2) at compile time. |
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.
Thanks for the clarification. And yeah, I think it's best to add the requested constants for now and if anyone requests the others we can add them the same way.
Thanks! And congrats for your first merged Godot contribution 🎉 |
I added some of the more commonly used constants to the shading language.
Issue #20726
Bugsquad edit: Closes #20726.
master
version of #52315.