yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//TEST(compute):COMPARE_COMPUTE:-vk -compute -profile cs_6_2 -render-features half -shaderobj 2//TEST(compute):COMPARE_COMPUTE:-cuda -compute -render-features half -shaderobj 3 4//Disable on Dx12 for now - because writing to structured buffer produces unexpected results 5//TEST_DISABLED(compute):COMPARE_COMPUTE:-dx12 -compute -profile cs_6_2 -render-features half -shaderobj 6 7struct Thing 8{ 9 uint pos; 10 float radius; 11 half4 color; 12}; 13 14//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=16):out,name outputBuffer 15RWStructuredBuffer<Thing> outputBuffer; 16 17[numthreads(4, 1, 1)] 18void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 19{ 20 uint tid = dispatchThreadID.x; 21 22 float v = float(tid); 23 24 float base = v* 4.0f; 25 26 Thing thing; 27 thing.pos = tid; 28 thing.color = half4(float4(base, base + 1.0f, base + 2.0f, base + 3.0f)); 29 thing.radius = v; 30 31 outputBuffer[tid] = thing; 32}