yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
138efb9c2
master
1//TEST:INTERPRET(filecheck=CHECK): 2 3interface IFoo 4{ 5 void test(); 6}; 7 8struct Foo<let GenericValue : uint> : IFoo 9{ 10 void test() 11 { 12 printf("GenericValue=%d, value=%d\n", GenericValue, value); 13 } 14 15 uint value; 16}; 17 18void testInterfaceAsParameter(IFoo foo) 19{ 20 foo.test(); 21} 22 23void testInterfaceAsGeneric<T:IFoo>(T foo) 24{ 25 foo.test(); 26} 27 28void main() 29{ 30 // CHECK-COUNT-2:GenericValue=0, value=0 31 Foo<0> foo0 = {0}; 32 testInterfaceAsParameter(foo0); 33 testInterfaceAsGeneric(foo0); 34 35 // CHECK-COUNT-2:GenericValue=1, value=1 36 Foo<1> foo1 = {1}; 37 testInterfaceAsParameter(foo1); 38 testInterfaceAsGeneric(foo1); 39 40 // CHECK-COUNT-2:GenericValue=2, value=2 41 Foo<2> foo2 = {2}; 42 testInterfaceAsParameter(foo2); 43 testInterfaceAsGeneric(foo2); 44}