yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
2533125cb
master
1//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj 2//TEST(compute):COMPARE_COMPUTE:-shaderobj 3 4//TEST_INPUT: uniform(data=[1 2 3 4]):name=C.p.c 5//TEST_INPUT: Texture2D(size=4, content = one):name=C.p.t 6//TEST_INPUT: Sampler:name=C.p.s 7//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 8 9struct P 10{ 11 uint4 c; 12 Texture2D t; 13 SamplerState s; 14}; 15 16float4 test(P p) 17{ 18 return p.t.SampleLevel(p.s, float2(0.0), 0) + p.c; 19} 20 21cbuffer C 22{ 23 P p; 24}; 25 26RWStructuredBuffer<float> outputBuffer; 27 28[numthreads(1, 1, 1)] 29void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 30{ 31 float4 outVal = test(p); 32 33 outputBuffer[0] = outVal.x; 34 outputBuffer[1] = outVal.y; 35 outputBuffer[2] = outVal.z; 36 outputBuffer[3] = outVal.w; 37}