yum-mirror/slang

Making it easier to work with shaders

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

Yong HeEnsure generic constraints are checked before inner extension. (#7685)90c34e3db

master
604 B35 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type
2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-d3d11 -output-using-type
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
5
6#pragma warning(disable:30856)
7
8public interface A<T: IFloat>
9{
10}
11
12public extension<T1: IFloat, a1 : A<T1>> a1
13{
14    void foo() {
15        outputBuffer[0] = 1.0;
16    }
17}
18
19RWStructuredBuffer<float> outputBuffer;
20struct S : A<float> {
21}
22
23void helper<T: IFloat, a : A<T>>(a a2)
24{
25    a2.foo();
26}
27
28// CHECK: 1
29
30[numthreads(1,1,1)]
31void computeMain()
32{
33    S a;
34    helper(a);
35}