Cause and mechanism
A Custom Function adds your HLSL code to Shader Graph. String mode contains the function body inside the node; File mode calls a function from an external file. For compilation errors, check the precision suffix on the function name, input/output order and types, and included files.
Check and correct the setup
- In File mode define the suffixed function, but enter the unsuffixed Name on the node.
Follow input, processing / condition, then output - In String mode write the body and use $precision where needed; do not duplicate a full generated declaration.
Follow input, processing / condition, then output - Match port order/types, including outputs, and inspect the first shader error.
Follow input, processing / condition, then output
Limits and verification
A half call cannot resolve a float-only function. Fix precision or provide the required variants.
Shader Graph Custom Function node
A focused diagnostic setup
Reduce to one constant output and establish a compiling baseline in either String or File mode rather than mixing their syntax.
Test in this order
- Align File-mode node name, precision-suffixed function and ordered input/out ports.
Follow input, processing / condition, then output - For Float-success/Half-failure inspect the required function precision and graph setting.
Follow input, processing / condition, then output - Restore inputs, textures and includes incrementally and fix the first new error.
Follow input, processing / condition, then output
Interpret the result
Failure with constant output prioritizes function/reference setup. Successful compilation with wrong color instead calls for types, ranges and spaces.
Related explanations
- Custom Function (Custom Function Node)
- Check Custom Function and SRP Batcher compatibility
- HLSL (High-Level Shader Language)