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 crash when using a varying in separate func before it defined #94671

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Jul 23, 2024

This will fix the shader crash, when the function used the varying before it's defined:

shader_type spatial;

varying vec3 foo;

vec3 function1() {
	return foo;
}

void vertex() {
	vec3 v = function1(); // BUG
}

void fragment() {
	foo = vec3(1, 0, 1); // Fragment-to-light varying.
}

I've also

@Chaosus Chaosus requested a review from a team as a code owner July 23, 2024 18:13
@Chaosus Chaosus added this to the 4.3 milestone Jul 23, 2024
@Chaosus Chaosus force-pushed the shader_fix_varying branch 2 times, most recently from a57c580 to 9579d1d Compare July 23, 2024 18:31
@Chaosus
Copy link
Member Author

Chaosus commented Jul 23, 2024

Note: by "crash" here, I mean the shader compiler failure with long list of errors, not an actual crash :)

@Chaosus Chaosus removed the crash label Jul 23, 2024
@akien-mga akien-mga merged commit 62c88a4 into godotengine:master Jul 24, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@Chaosus Chaosus deleted the shader_fix_varying branch July 24, 2024 08:34
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.

Shader: can't use varyings as read-only parameters in custom functions
2 participants