yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
467fa3a5d
master
1//TEST:SIMPLE:-target cpp -stage compute -entry computeMain -obfuscate -line-directive-mode none 2 3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 4RWStructuredBuffer<float> outputBuffer; 5 6#if 0 7[DllExport] 8String getString() 9{ 10 return "Hello!"; 11} 12#endif 13 14int silly(int a) 15{ 16 int t = 0; 17 [ForceUnroll(10)] 18 while ( a > 0) 19 { 20 t = t + t + a; 21 } 22 return t; 23} 24 25[numthreads(1, 1, 1)] 26void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 27{ 28 int x = int(dispatchThreadID.x); 29 30 //String v = getString(); 31 int v = silly(x); 32 33 outputBuffer[x] = v; 34 35} 36