yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
69cb6e8f3
master
1//TEST:CPU_REFLECTION: -profile cs_5_0 -entry computeMain -target cpp -no-codegen 2 3 4struct Thing 5{ 6 int a; 7 float b; 8 float c; 9}; 10 11static int value; 12 13// Don't use parameter block for now 14//ParameterBlock<AnotherThing> s_paramBlock; 15 16ConstantBuffer<Thing> thing3; 17 18//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out 19RWStructuredBuffer<int> outputBuffer; 20 21Texture2D<float> tex; 22SamplerState sampler; 23 24[numthreads(4, 1, 1)] 25void computeMain( 26 uint3 dispatchThreadID : SV_DispatchThreadID, 27 uniform Thing thing, 28 uniform Thing thing2) 29{ 30 uint tid = dispatchThreadID.x; 31 32 // TODO(JS): Doesn't emit correctly on c++ becomes... 33 // Vector<float, 2> loc_0 = Vector<float, 2>{Vector<uint32_t, 2>{dispatchThreadID_0.x, dispatchThreadID_0.y}} * 0.50000000000000000000f; 34 //float2 loc = dispatchThreadID.xy * 0.5f; 35 36 float2 loc = float2(dispatchThreadID.x * 0.5f, dispatchThreadID.y * 0.5f); 37 38 float v = tex.Load(int3(tid, tid, 0)); 39 float s = tex.Sample(sampler, loc); 40 41 outputBuffer[tid] = int(tid * tid) + thing.a + thing3.a + int(v + s) + value; // + thing.a; 42}