summaryrefslogtreecommitdiffstats
path: root/tests/spirv/pointer-default-constructor.slang
blob: 6ab29f1256c9f87c8282a95ba77b74a4d28a7617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -emit-spirv-directly -output-using-type

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<uint> outputBuffer;

struct MyStruct
{
    int* ptr;
}

[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain()
{
    float* a = {};
    MyStruct ms = {};

    // CHECK: 0
    outputBuffer[0] = uint(uint64_t(a));
    // CHECK: 1
    outputBuffer[1] = uint(a == nullptr);
    // CHECK: 0
    outputBuffer[2] = uint(uint64_t(ms.ptr));
    // CHECK: 1
    outputBuffer[3] = uint(ms.ptr == nullptr);
}