godot
godot copied to clipboard
Fix shader type detection
- Fixes https://github.com/godotengine/godot/issues/78482
The problem was that get_shader_type() was called too early, before the preprocessing step. This PR moves the check after the preprocessing and uses the preprocessed shader code to figure out the shader_type. This makes sure the shader compiler only sees valid shader code that has all preprocessor statements removed, so that get_shader_type() can correctly parse the code and figure out the type. Previously, any preprocessor statements before the shader_type xyz; would cause a silent parsing failure and the shader type would default to spatial.