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// Hilariously low precision because the different APIs don't agree (they're 6// not specced to of course, so it's ok) 7// CHECK: type: float 8// CHECK-NEXT: 0.761 9// CHECK-NEXT: 0.964 10// CHECK-NEXT: 0.995 11// CHECK-NEXT: 0.999 12 13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 14RWStructuredBuffer<float> outputBuffer; 15 16//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4),name=input 17ByteAddressBuffer input; 18 19[numthreads(1, 1, 1)] 20void computeMain() 21{ 22 CoopVec<float, 4> vec = coopVecLoad<4, float>(input); 23 24 CoopVec<float, 4> result = tanh(vec); 25 26 for(int i = 0; i < result.getCount(); ++i) 27 outputBuffer[i] = result[i]; 28}