yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
26ca9c5b0
master
1// Test that we allow type conformances whose base interface is generic. 2 3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-dx11 -compute -output-using-type 4//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -output-using-type 5 6interface IStack<let D : int> 7{ 8 IStack<D - N> popN<let N : int>(); 9 10 int get(); 11} 12struct StackImpl<let D : int> : IStack<D> 13{ 14 // member 'popN' does not match interface requirement. 15 StackImpl<D - N> popN<int N>() { return StackImpl<D - N>(); } 16 17 int get() { return D; } 18} 19 20int helper<int n, T : IStack<n>>(T stack) 21{ 22 return stack.popN<2>().get(); 23} 24 25//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4); 26RWStructuredBuffer<int> outputBuffer; 27 28[numthreads(1, 1, 1)] 29void computeMain() 30{ 31 StackImpl<5> obj = StackImpl<5>(); 32 33 // CHECK: 3 34 outputBuffer[0] = helper(obj); 35}