yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8086adc90
master
1//TEST:SIMPLE(filecheck=METAL): -target metal 2//TEST:SIMPLE(filecheck=METALLIB): -target metallib 3//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type 4//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type 5 6//TEST_INPUT: ubuffer(data=[2.0], stride=1):out,name outputBuffer 7uniform RWStructuredBuffer<float> outputBuffer; 8 9struct MyBlock 10{ 11 StructuredBuffer<float> b1; 12 StructuredBuffer<float> b2; 13} 14ParameterBlock<MyBlock> block; 15 16groupshared int myArr[16]; 17 18void func(float v) 19{ 20 // BUF: 0.000000 21 outputBuffer[0] = myArr[0]; 22} 23 24// METAL: array<int, int(16)> threadgroup* myArr{{.*}}; 25// METAL: {{\[\[}}kernel{{\]\]}} void computeMain 26// METAL: threadgroup array<int, int(16)> myArr{{.*}}; 27// METAL: (&kernelContext{{.*}})->myArr{{.*}} = &myArr{{.*}}; 28// METALLIB: define void @computeMain 29 30[numthreads(1,1,1)] 31void computeMain(uint3 tid: SV_DispatchThreadID) 32{ 33 myArr[tid.x] = tid.x; 34 func(3.0f); 35}