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 VisualShaderNodeVaryingGetter expanded ports adding ".x" to shader #92847

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

aaronp64
Copy link
Contributor

@aaronp64 aaronp64 commented Jun 6, 2024

When VisualShaderNodeVaryingGetter type was Vector2/Vector3/Vector4, expanding the output ports and connecting an individual value to a scalar input would add ".x" to the assignment in the generated shader. This was due to VisualShaderNodeVarying::get_port_type ignoring the port number, and always returning the associated vector type. Added checks for p_port == 0 to return either the vector type, or scalar for expanded ports, matching similar logic in other nodes, like VisualShaderNodeColorConstant::get_output_port_type.

Fixes #92832

When VisualShaderNodeVaryingGetter type was Vector2/Vector3/Vector4, expanding the output ports and connecting an individual value to a scalar input would add ".x" to the assignment in the generated shader.  This was due to `VisualShaderNodeVarying::get_port_type` ignoring the port number, and always returning the associated vector type.  Added checks for `p_port == 0` to return either the vector type, or scalar for expanded ports, matching similar logic in other nodes, like `VisualShaderNodeColorConstant::get_output_port_type`.

Fixes godotengine#92832
@aaronp64 aaronp64 requested a review from a team as a code owner June 6, 2024 19:27
@AThousandShips AThousandShips added this to the 4.3 milestone Jun 6, 2024
Copy link
Contributor

@QbieShay QbieShay left a comment

Choose a reason for hiding this comment

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

LGTM. IIRC you can check port type with a string too, I don't know what's better in that case. @Chaosus ?

@akien-mga akien-mga requested a review from Chaosus June 7, 2024 21:14
@akien-mga akien-mga merged commit 0d1f239 into godotengine:master Jun 11, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronp64 aaronp64 deleted the varying_getter_port_type branch June 28, 2024 14:43
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.

VaryingGetterNode rgb port problem
5 participants