godotengine / godotengine/godot-docs
Explain somewhere why we can't have global variables in shaders which pass data to all shader functions (vertex, light, fragment)
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:** 4.0.2
**Issue description:**
https://github.com/godotengine/godot/issues/18460
https://github.com/godotengine/godot-proposals/issues/2022
https://github.com/godotengine/godot/pull/44698
I've came across this today trying to figure out how to pass data between the fragment and light functions and want to say: even though the error messages which are implemented now are useful in a sense they tell me what I can't do, they don't tell me anything about _why_ I can't do that or what would be a better or recommended solution.
We have at least 3 global variable types (that I know of): `const`, `uniform `and `varying`. But non of them I really can pass data through all shader functions (vertex, light, fragment). I'm sure there is a good reason why this is heaving read some GitHub discussions it seems like it at least. But I have not found any info neither on the docs or in the GitHub comments on why this is. It would be nice to have this info somewhere as it is easier to remember special cases when they make sense and have a reason.
**URL to the documentation page (if already existing):**
https://github.com/godotengine/godot/issues/18460
https://github.com/godotengine/godot-proposals/issues/2022
https://github.com/godotengine/godot/pull/44698
https://docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/shading_language.html
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.