Hi Everyone,
With the new Unity.mathematics library we can now write more or less identical code for (compute) shaders and c#. Fantastic!
But *really* great would be if I could use a single source file for all common code. Maintaining identical code across c# and HLSL would then be trivial. (For example, noise functions that can be used in both c# and compute shaders and custom shader graph nodes)
This could be easily done with #include. I could just put all the common code in .cginc files and then just #include them in my csharp code...
e.g..
public static class ixMath
{
#include "hashFunctions.cginc"
#include "noiseFunctions.cginc"
}
Unfortunately CSharp doesnt allow #include. Can anyone suggest another solution?
How do you all do this?
↧