yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d58243d90
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly 2 3// CHECK: type: float 4// CHECK-NEXT: 3.000000 5// CHECK-NEXT: 6.000000 6// CHECK-NEXT: 9.000000 7// CHECK-NEXT: 12.000000 8 9//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 4.0], stride=4, count=256):name=inputBuffer 10StructuredBuffer<float> inputBuffer; 11 12//TEST_INPUT:ubuffer(stride=4, count=256):out,name=outputBuffer 13RWStructuredBuffer<float> outputBuffer; 14 15using namespace linalg; 16 17typealias CoopMatType = CoopMat<float, MemoryScope.Subgroup, 16, 16, CoopMatMatrixUse::MatrixAccumulator>; 18 19static let stride = 16; 20//static let matrixLayout = CoopMatMatrixLayout::RowMajor; 21static const CoopMatMatrixLayout matrixLayout = CoopMatMatrixLayout::RowMajor; 22 23void processCoopMat(CoopMatType mat) 24{ 25 // XXX: hmmm, some error when matrixLAyout is static let 26 (mat * 3.0).Store<CoopMatMatrixLayout::RowMajor>(outputBuffer, 0, stride); 27} 28 29[numthreads(32, 1, 1)] 30void computeMain() 31{ 32 let mat = CoopMatType.Load<CoopMatMatrixLayout::RowMajor>(inputBuffer, 0, stride); 33 processCoopMat(mat); 34}