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.8 KiB58 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -dx12 -profile cs_6_0 -shaderobj -output-using-type
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -output-using-type
3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj -output-using-type
4//TEST:SIMPLE(filecheck=LIB):-target metallib -entry computeMain -stage compute -DMETAL
5//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -shaderobj -output-using-type
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0 0]):name=uintBuffer
8RWByteAddressBuffer uintBuffer;
9
10//TEST_INPUT: ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ], stride=4):out,name outputBuffer
11RWStructuredBuffer<float> outputBuffer;
12
13[numthreads(1,1,1)]
14void computeMain()
15{
16    uintBuffer.InterlockedAdd(0, 1);
17    int oldValue;
18    //LIB: call {{.*}}.atomic.global.add.u.i32
19    uintBuffer.InterlockedAdd(0, 1, oldValue);
20    // BUF: 1
21    outputBuffer[0] = oldValue;
22
23    uintBuffer.InterlockedAdd(0, 1, oldValue);
24    // BUF: 2
25    outputBuffer[1] = (int)oldValue;
26
27    uintBuffer.InterlockedCompareExchange(0, 3, 4, oldValue);
28    // BUF: 3
29    outputBuffer[2] = (int)oldValue;
30
31    uintBuffer.InterlockedOr(0, 3, oldValue);
32    // BUF: 4
33    outputBuffer[3] = oldValue; // 4
34
35    uintBuffer.InterlockedExchange(0, 4, oldValue);
36    // BUF: 7
37    outputBuffer[4] = oldValue; // 7
38
39    uintBuffer.InterlockedMin(0, 3, oldValue);
40    // BUF: 4
41    outputBuffer[5] = oldValue; // 4
42
43    uintBuffer.InterlockedMax(0, 4, oldValue);
44    // BUF: 3
45    outputBuffer[6] = oldValue; // 3
46
47    uintBuffer.InterlockedAnd(0, 7, oldValue);
48    // BUF: 4
49    outputBuffer[7] = oldValue; // 4
50
51    uintBuffer.InterlockedXor(0, 7, oldValue);
52    // BUF: 4
53    outputBuffer[8] = oldValue; // 4
54
55    // BUF: 3
56    outputBuffer[9] = uintBuffer.Load(0);
57
58}