Figure: Diagnostic workflow: Choose String/File mode → Match types and precision → Fix first compiler error
Figure: Diagnostic workflow: Choose String/File mode → Match types and precision → Fix first compiler error

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

  1. In File mode define the suffixed function, but enter the unsuffixed Name on the node.
    Follow input, processing / condition, then output
    Follow input, processing / condition, then output
  2. In String mode write the body and use $precision where needed; do not duplicate a full generated declaration.
    Follow input, processing / condition, then output
    Follow input, processing / condition, then output
  3. Match port order/types, including outputs, and inspect the first shader error.
    Follow input, processing / condition, then output
    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

  1. Align File-mode node name, precision-suffixed function and ordered input/out ports.
    Follow input, processing / condition, then output
    Follow input, processing / condition, then output
  2. For Float-success/Half-failure inspect the required function precision and graph setting.
    Follow input, processing / condition, then output
    Follow input, processing / condition, then output
  3. Restore inputs, textures and includes incrementally and fix the first new error.
    Follow input, processing / condition, then output
    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

References