-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Trying to modify a varying from fragment shader crashes the editor #83742
Comments
Looks like because the shader is failed to compile, it's This kind of usage of varying is wrong and needs to be handled well in shader processing, the above code will generate the following code, for vertex:
For fragment the generated code is wrong:
|
Note that assigning to a varying in more than one stage is not allowed, unsure why that error does not show up, might be something with the swizzling, what happens if you just assigns the whole variable? Also what happens if you assign with swizzle in the vertex shader? |
Yes, if I change to
It's fine, no error, no warning. Looks like using swizzle will make godot's varying assignment check fail. When use swizzle, it get parsed as a member node with it's owner set as the varying variable. |
#83780 Will stop this MRP from crashing, but this is also an error that needs to be detected in our shader compiler so we can provide a helpful error in the editor and highlight the right line for the user. |
I think I found where the culprit is, I will make a seperate PR for this. |
What's the progress of, or limitations to, adding tests for the shader compiler? Ensuring some fundamental functionality |
Godot version
4.2.beta (6543495)
System information
Godot v4.2.beta (6543495) - Ubuntu 22.04.3 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (nvidia; 525.125.06) - Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 Threads)
Issue description
In a spatial shader, I inadvertently tried to modify the value of a varying from the fragment method. It crashed the editor.
I am not sure if this should be allowed or not in the first place, but I didn't see any mention of such restriction in the documentation.
Steps to reproduce
Create a spatial shader like below and uncomment the last line:
Result:
Minimal reproduction project
mrp.zip
The text was updated successfully, but these errors were encountered: