Does SparkSL optional works on vec3 and floats?

Seems like optional works only with textures, but the documentation states that it should work with everything.

With this example, I am not able to see any optional behaviour of the shader. When not connected, the values are always stayed at zero.

vec4 main(optional<vec4> v0, optional<vec4> v1) {
    return v0.valueOr(v1).valueOr(vec4(0.0, 1.0, 0.0, 1.0));
}        

I remember trying this a while back but I couldn’t get it working with non-texture values. The main problem is that the values aren’t undefined. You can see they are defined by the patch defaults. There’s no such thing as an undefined vec4 on a patch since the defaults are all zeros.

In my case, I was using uvs, so I just check if the uv was vec2(0, 0) and then used a default uv under the hood. It’s kind of inefficient and fragile, but that’s how I was able to define a uv default if nothing was plugged in.

I was thinkg the same that default is 0 for all floats.
For uv I would use -1, but this add some overhead on conditionals.