yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
2ea64ff4f
master
1//TEST:CPP_COMPILER_COMPILE: -profile cs_5_0 -entry computeMain -target callable 2 3struct Thing 4{ 5 int a; 6 float b; 7}; 8 9static int value; 10 11// Don't use parameter block for now 12//ParameterBlock<AnotherThing> s_paramBlock; 13 14ConstantBuffer<Thing> thing3; 15 16//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out 17RWStructuredBuffer<int> outputBuffer; 18 19Texture2D<float> tex; 20SamplerState sampler; 21 22void doSomething(int a, inout float3 v[2]) 23{ 24 v[0] = float3(float(a)); 25 v[1] = float3(float(a + 1)); 26} 27 28[numthreads(4, 1, 1)] 29void computeMain( 30 uint3 dispatchThreadID : SV_DispatchThreadID, 31 uniform Thing thing, 32 uniform Thing thing2) 33{ 34 uint tid = dispatchThreadID.x; 35 36 int2 fromScalar = tid.x; 37 uint2 another = {}; 38 39 float2 loc = dispatchThreadID.xy * 0.5f; 40 41 float v = tex.Load(int3(tid, tid, 0)); 42 float s = tex.Sample(sampler, loc); 43 44 // This should promote the 0.0 into a float2, 45 float l = tex.Sample(sampler, 0.0); 46 47 float3 m = float(3).xxx; 48 49 float3 arr[2] = { float3(3), float3(4) }; 50 doSomething(int(tid), arr); 51 52 outputBuffer[tid] = int(tid * tid) + thing.a + thing3.a + int(v + s) + value + fromScalar.y + int(another.y) + int(m.x) + int(l) + int(arr[0].y); // + thing.a; 53}