yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
92ae4949f
master
1//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj 2//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 6 7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 8 9RWStructuredBuffer<float> outputBuffer; 10 11interface IPrintable 12{ 13 int getHash(); 14}; 15 16extension String : IPrintable 17{ 18 int getHash() { return getStringHash(this); } 19} 20 21int getHash(IPrintable p) { return p.getHash(); } 22 23[numthreads(4, 1, 1)] 24void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 25{ 26 uint tid = dispatchThreadID.x; 27 28 int hash = getHash("Hello World!"); 29 30 float inVal = float(tid) + hash; 31 32 outputBuffer[tid] = inVal; 33}