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(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -output-using-type -profile cs_6_9 -Xslang... -Xdxc -Vd -X. 3//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type 4 5// CHECK: type: float 6// CHECK-NEXT: 5.000000 7// CHECK-NEXT: 10.000000 8// CHECK-NEXT: 17.000000 9// CHECK-NEXT: 26.000000 10 11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 12RWStructuredBuffer<float> outputBuffer; 13 14//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input1 15ByteAddressBuffer input1; 16 17//TEST_INPUT:ubuffer(data=[2.0 3.0 4.0 5.0], stride=4),name=input2 18ByteAddressBuffer input2; 19 20//TEST_INPUT:ubuffer(data=[3.0 4.0 5.0 6.0], stride=4),name=input3 21ByteAddressBuffer input3; 22 23[numthreads(1, 1, 1)] 24void computeMain() 25{ 26 CoopVec<float, 4> vec1 = coopVecLoad<4, float>(input1); 27 CoopVec<float, 4> vec2 = coopVecLoad<4, float>(input2); 28 CoopVec<float, 4> vec3 = coopVecLoad<4, float>(input3); 29 30 CoopVec<float, 4> result = fma(vec1, vec2, vec3); 31 32 for(int i = 0; i < result.getCount(); ++i) 33 outputBuffer[i] = result[i]; 34}