yum-mirror/slang

Making it easier to work with shaders

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

Yong HeSupport `expand` on concrete tuple values. (#8106)7cd8130e1

master
540 B26 linesraw
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
2
3//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0], stride=4)
4
5#lang 2026
6
7RWStructuredBuffer<int> outputBuffer;
8
9int f(int x, float y) { return x + int(y); }
10
11int g<each T>(expand each Tuple<expand each T> t)
12{
13    return countof(t);
14}
15
16[numthreads(1,1,1)]
17void computeMain()
18{
19    Tuple<expand each Tuple<int, float>> x = (2, 3.0f);
20    
21    // CHECK: 2
22    outputBuffer[0] = g<int, float>(expand each x);
23
24    // CHECK: 5
25    outputBuffer[1] = f(expand each x);
26}