summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/tuple/tuple-expand-call.slang
blob: f2293f03fab16d4edb16d29399b01b259ba16b12 (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:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type

//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0], stride=4)

#lang 2026

RWStructuredBuffer<int> outputBuffer;

int f(int x, float y) { return x + int(y); }

int g<each T>(expand each Tuple<expand each T> t)
{
    return countof(t);
}

[numthreads(1,1,1)]
void computeMain()
{
    Tuple<expand each Tuple<int, float>> x = (2, 3.0f);
    
    // CHECK: 2
    outputBuffer[0] = g<int, float>(expand each x);

    // CHECK: 5
    outputBuffer[1] = f(expand each x);
}