yum-mirror/slang

Making it easier to work with shaders

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

Darren WihandiAdd default constructor for Ptr type (#7214)6209f69f3

master
592 B26 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -emit-spirv-directly -output-using-type
2
3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
4RWStructuredBuffer<uint> outputBuffer;
5
6struct MyStruct
7{
8    int* ptr;
9}
10
11[shader("compute")]
12[numthreads(1, 1, 1)]
13void computeMain()
14{
15    float* a = {};
16    MyStruct ms = {};
17
18    // CHECK: 0
19    outputBuffer[0] = uint(uint64_t(a));
20    // CHECK: 1
21    outputBuffer[1] = uint(a == nullptr);
22    // CHECK: 0
23    outputBuffer[2] = uint(uint64_t(ms.ptr));
24    // CHECK: 1
25    outputBuffer[3] = uint(ms.ptr == nullptr);
26}