summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/interfaces/pointer-marshalling-no-int64.slang
blob: 030a8b6c741030bae8577f73b5aba99a966288ef (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//TEST:SIMPLE(filecheck=CHECK): -target spirv

// CHECK-NOT: Int64

RWStructuredBuffer<uint> result;

struct Data
{
    uint *index_buffer;
    uint type;
};

ConstantBuffer<Data> global_data;

interface IIndexFetcher
{
    uint get_index();
};

struct IndexFetcherU32 : IIndexFetcher
{
    uint *m_ptr;

    __init(uint *ptr) 
    {
        m_ptr = ptr;
    }
    
    uint get_index()
    {
        return 42; // Simplified to avoid dereference issues
    }
};

struct IndexFetcherSimple : IIndexFetcher
{
    uint value;

    __init(uint val) 
    {
        value = val;
    }

    uint get_index()
    {
        return value;
    }
};

[shader("compute")]
void main()
{
    IIndexFetcher pf;
    if (global_data.type == 0) {
        pf = IndexFetcherU32(global_data.index_buffer);
    } else {
        pf = IndexFetcherSimple(100);
    } 
  
    result[0] = pf.get_index();
}