yum-mirror/slang

Making it easier to work with shaders

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

Yong HeFix inccorect dropping of declref during Unification of DeclaredSubtypeWitness. (#5041)f51b74dde

master
1.1 KiB41 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -shaderobj -output-using-type
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -output-using-type
3
4interface IValueGeneric<let D : int> {}
5struct ValGenericImpl<let D : int> : IValueGeneric<D> {}
6
7struct NestedValueGeneric<let D : int, S : IValueGeneric<D>>
8{
9    int x;
10}
11
12void acceptor<let D : int, S : IValueGeneric<D>>(NestedValueGeneric<D, S> x)
13{
14    outputBuffer[0] = D + x.x;
15}
16
17extension<let D : int, S : IValueGeneric<D>> NestedValueGeneric<D, S>
18{
19    void foo()
20    {
21        acceptor(this);
22    }
23}
24void test2(NestedValueGeneric<2, ValGenericImpl<2>> x)
25{
26    // 'foo' should be a member of 'NestedValueGeneric<2, ValGenericImpl<2>>' through
27    // the extension above.
28    x.foo();
29}
30
31//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
32RWStructuredBuffer<int> outputBuffer;
33
34[numthreads(1, 1, 1)]
35void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
36{
37    NestedValueGeneric<2, ValGenericImpl<2>> x;
38    x.x = 1;
39    test2(x);
40    // CHECK: 3
41}