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
939 B32 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}
16void test(NestedValueGeneric<2, ValGenericImpl<2>> x)
17{
18    // Test that we can correctly infer acceptor.D and acceptor.S from `x`.
19    acceptor(x);
20}
21
22//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
23RWStructuredBuffer<int> outputBuffer;
24
25[numthreads(1, 1, 1)]
26void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
27{
28    NestedValueGeneric<2, ValGenericImpl<2>> x;
29    x.x = 1;
30    test(x);
31    // CHECK: 3
32}