yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
54d9b345b
master
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -output-using-type 2 3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 4RWStructuredBuffer<float> outputBuffer; 5// BUF: 1.000000 6// BUF: 1.000000 7 8struct TestStruct : IDifferentiable 9{ 10 static const no_diff float foo = 1.0f; 11 12 int x; 13 14 void assignOut() 15 { 16 outputBuffer[0] = foo; 17 } 18} 19no_diff static const float foo = 1.0f; 20 21[shader("compute")] 22[numthreads(1, 1, 1)] 23void computeMain(uint thread_idx: SV_DispatchThreadID) 24{ 25 if (thread_idx == 0) { 26 TestStruct t; 27 t.x = 10; 28 t.assignOut(); 29 } 30 outputBuffer[1] = foo; 31}