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

Global shader uniforms do not work #57200

Closed
Uxeron opened this issue Jan 25, 2022 · 1 comment · Fixed by #57207
Closed

Global shader uniforms do not work #57200

Uxeron opened this issue Jan 25, 2022 · 1 comment · Fixed by #57207

Comments

@Uxeron
Copy link
Contributor

Uxeron commented Jan 25, 2022

Godot version

v4.0.alpha.custom_build [fc09d78]

System information

Windows 10

Issue description

Shader global uniforms are broken, throwing "Global uniform does not exist" errors when running a project.

Additionally, "This function should never be used outside the editor, it can severely damage performance." errors are thrown along with the shader errors. This is caused by a !Engine::get_singleton()->is_editor_hint() check in RendererStorageRD::global_variable_get_type, which works in the editor, but fails when actually running the project.

This all seems to have been caused by 99064d5, by changing a global_variable_get_type_internal call in ShaderCompiler::_get_variable_type to a global_variable_get_type call. This would be simple to fix by just reverting to the previous function call, but it seems to have been a part of a bigger refactoring, so perhaps there is a better way to do it now?

Steps to reproduce

Add a global shader uniform in project settings.
Create a canvas shader that uses that global uniform.
Use the shader in any canvas item node in the scene tree.
Run the project.

Minimal reproduction project

GlobalUniformsTest.zip

@AlexandrDzyuba
Copy link

I have the same error in Godot 4.3 dev5 with every sampler2D global uniform.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants