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

Fix shader type detection #79287

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

bitsawer
Copy link
Member

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.

@bitsawer bitsawer added this to the 4.2 milestone Jul 10, 2023
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@YuriSizov YuriSizov added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 10, 2023
@YuriSizov YuriSizov merged commit ead69eb into godotengine:master Jul 14, 2023
13 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@bitsawer bitsawer deleted the fix_shader_type_detection branch July 14, 2023 19:04
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.2.

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabling shader pre-processor displays editor-only error about unknown built-ins
4 participants