yum-mirror/slang

Making it easier to work with shaders

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

skallweitNVenable more metal tests (#4326)712ce653d

master
562 B30 linesraw
1// interface-extension.slang
2
3// Test that an `extension` applied to an interface type works as users expect
4
5//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj
6
7struct MyType
8{
9    int v;
10}
11
12extension MyType
13{
14    int foo()
15    {
16        return v;
17    }
18}
19
20//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
21RWStructuredBuffer<int> outputBuffer;
22
23[numthreads(4, 1, 1)]
24void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
25{
26    MyType t;
27    t.v = 1;
28    // CHECK: 1
29    outputBuffer[dispatchThreadID.x] = t.foo();
30}