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

Prevent redefinition of main functions in shader #56750

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Jan 13, 2022

Prevent writing such code:

shader_types spatial;

void fragment() {
}

void fragment() {
}

Note, that due to vertex/fragment/light technically are not functions, but just code fragments inserted into the main function parser must not prevent writing code like this:

void fragment() {
}

const vec3 fragment = vec3(1, 0, 0);

so I did not modify a _find_identifier for this.

@Chaosus Chaosus requested a review from a team as a code owner January 13, 2022 12:13
@Chaosus Chaosus added this to the 4.0 milestone Jan 13, 2022
@akien-mga akien-mga merged commit 99b46a2 into godotengine:master Jan 13, 2022
@akien-mga
Copy link
Member

Thanks!

@Chaosus Chaosus deleted the shader_fix_main_function_decl branch January 13, 2022 13:09
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.

2 participants