FShade icon indicating copy to clipboard operation
FShade copied to clipboard

Invalid characters in function names

Open luithefirst opened this issue 3 years ago • 1 comments

I've tried to use a function with a prime character in its name in a compute shader (like we do so often in the f# world). This is translated 1:1 to glsl:

...
float HiliteShaders_SpecularDenoiseCompute_getSpecMagicCurve'_zyS3pDZ51CZk00MS3tzYpQ1Q0FyI(float roughness, float power)
...

and then you get an error like: error C0160: invalid character literal

It would be nice if we add a check if a function name is valid (ascii only) and if not find an appropriate substitute. A general scheme might be to replace "invalid" chars with their char code as sting. The prime character would then be replaced by "U2023", which should give us a deterministic (almost) unique name (I would not expect someone to actually write another function with this exact name). This is just a suggestion to start the discussion, for me any other mechanism that lets me use the code I naturally write (without needing to remember all the FShade restrictions) would be fine.

luithefirst avatar Aug 24 '22 14:08 luithefirst

There is name-mangling and afaik it handled these things correctly in the past

krauthaufen avatar Aug 24 '22 14:08 krauthaufen