yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

James Helferty (NVIDIA)Enable metal tests (#8446)8086adc90

master
1.1 KiB37 linesraw
1//TEST:SIMPLE(filecheck=METAL): -entry computeMain -stage compute -target metal -D GROUPID
2//TEST:SIMPLE(filecheck=METAL): -entry computeMain -stage compute -target metal
3//DISABLE_TEST(compute, metal):COMPARE_COMPUTE(filecheck-buffer=BUF):-metal -compute -entry computeMain -output-using-type
4//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type
5
6// Compute test disabled; Buffer isn't handled by the test infrastructure
7// TODO: github issue #8456
8
9//METAL: computeMain
10
11// ensure we compute the SV_GroupIndex from SV_GroupThreadID and `numthreads`
12// METAL: thread_position_in_threadgroup
13// METAL-DAG: *{{.*}}2
14
15//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name dst
16RWBuffer<uint> dst;
17
18void indirection(uint groupIndex)
19{
20    dst[groupIndex] = groupIndex;
21}
22
23#define THREAD_COUNT 2
24[numthreads(THREAD_COUNT, 1, 1)]
25#ifdef GROUPID
26void computeMain(uint GI : SV_GroupIndex, uint GTID : SV_GroupThreadID)
27#else
28void computeMain(uint GI : SV_GroupIndex)
29#endif
30{
31    // BUF: 0
32    // BUF: 1
33    dst[GI + THREAD_COUNT] = GI;
34    // BUF: 0
35    // BUF: 1
36    indirection(GI);
37}