yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
447b7e0e2
master
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 2 3/* Test use of a generic with a built in doing something simple. 4 5Doesn't work because cannot find +. 6 7.slang(3): error 39999: no overload for '+' applicable to arguments of type (typeof(V), int) 8int doThing<V : int>(int b) { return V + b; } 9 10NOTE! We can fix by adding *let* 11 12int doThing<let V : int>(int b) { return V + b; } 13*/ 14 15//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 16RWStructuredBuffer<int> outputBuffer; 17 18int doThing<V : int>(int b) { return V + b; } 19 20[numthreads(4, 1, 1)] 21void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 22{ 23 int index = dispatchThreadID.x; 24 25 outputBuffer[dispatchThreadID.x] = doThing<2>(index); 26}