How does one prototype a function in a gdshader?

Godot Version

v4.2.2.stable.official [15073afe3]


How does one prototype a function in a gdshader?

For example, I have a function a() and function b().
These functions are declared in that order.
Function b() can call function a() without any issues, but function a() cannot call function b().

Trying to prototype a function, as it’s shown on most guides online, by declaring an empty function b() before function a(), just results in it asking me to declare function b() fully. If that is done, it complains about the later redefinition of function b().

Any advice?

I tried this and it probably isn’t possible.

My suggestion would be to avoid a recursive reference. Or you could have some level of an inline function with a macro maybe?

What kind of shading effect are you trying to accomplish?

Not a shading effect. Just a raymarcher. For simplicity’s sake I wanted to call the raymarch function from the function I use to determine if a spot is in shadow or not.