Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

Sharing code between shader and c# - how?

$
0
0
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?

Viewing all articles
Browse latest Browse all 169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>