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

Visual Shader not declaring a parameter when the nodes are only connected to a VaryingSetter #75735

Closed
VantaGhost opened this issue Apr 6, 2023 · 2 comments · Fixed by #83189

Comments

@VantaGhost
Copy link

Godot version

v4.0.2.stable.mono.official [7a0977c]

System information

Windows 10

Issue description

When using the Visual Shader editor, if the output of a set of nodes only connects to a VaryingSetter, any Parameter nodes will fail to declare themselves in the generated code. This causes an error in the shader when the missing parameter is accessed, breaking the whole shader.

This happens in both the Vertex and Fragment functions (that I've tested) and with different types of parameters.

Steps to reproduce

GodotVSBug

To Reproduce:

  1. Create a new visual shader
  2. In one of the shader functions (for example Vertex) create a new varying with the "manage varyings" button
  3. Add a varying setter node and set it to the new varying
  4. Add a parameter node of an appropriate type and connect to the varying setter
  5. Click on the "show generated shader code" button, you should see the unknown identifier error

Minimal reproduction project

N/A

@VantaGhost
Copy link
Author

For anyone else having this issue, you can work around this by manually declaring the uniform parameter in a global expression node. Unfortunately this will cause another error for redefining the parameter if for some reason the parameter is being declared properly by the node.

@Chaosus Chaosus added this to the 4.1 milestone Apr 20, 2023
@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@jsjtxietian
Copy link
Contributor

jsjtxietian commented Oct 12, 2023

Looks like the shader code generated for parameter nodes are wrong when connected to varying (did not generate the uniform declaration) , but when connected to something like output, it's fine.

Also when add a bool varying shader compiler failed bacause of flat cannot declare a bool variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants