Skip to content

[ShaderGraph] Make use of NodeResultType in NodeResult struct instead of just an int to define the result type#10508

Open
QuackCola wants to merge 4 commits intoFacepunch:masterfrom
QuackCola:shadergraph-use-NodeResultType
Open

[ShaderGraph] Make use of NodeResultType in NodeResult struct instead of just an int to define the result type#10508
QuackCola wants to merge 4 commits intoFacepunch:masterfrom
QuackCola:shadergraph-use-NodeResultType

Conversation

@QuackCola
Copy link
Copy Markdown
Contributor

Summary

The following pr in short replaces all the usage of

public NodeResult( int components, string code, bool constant = false )

with

public NodeResult( NodeResultType resultType, string code, bool constant = false )

while also modifying the NodeResult struct so that it stores the NodeResultType

I also replaced any usage of NodeResultType.Color with NodeResultType.Vector4.

Motivation & Context

Doing it this way makes more sense and will also better support a future change i have cooking up that involves adding
Texture2D and TextureCube NodeResultTypes.

The replacement of NodeResultType.Color with NodeResultType.Vector4 makes sense for me atleast whithin in the context of shhadergraph since it's just another way to represent a float4/vector4.

Nothing really changes for the user except maybe some obsolete warnings on custom c# defined nodes.

Implementation Details

Make some additional tweaks here and there to support the changes and also
obsoleted both

public NodeResult( int components, string code, bool constant = false )

and

NodeResultType.Color

Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • Public APIs are documented (if applicable)
  • Unit tests added where applicable and all passing
  • I’m okay with this PR being rejected or requested to change 🙂

Its better todo it this way than relying on the provided component count to see what result type the NodeResult is. This change will help support Texture2D and TextureCube NodeResultTypes in a future pr that i have cooking up.

I also Replaced NodeResultType.Color with NodeResultType.Vector4 as shaders don't really have a Color type but they do have a float4 type.
So that the ColorEditor shows up on the node for the RGBA out :)
@QuackCola QuackCola force-pushed the shadergraph-use-NodeResultType branch from 1b9639c to cd326eb Compare April 16, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant