yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9ec6b9168
master
1// this-in-extension.slang 2 3// Test that an `This` type works correctly when there is an extension. 4 5//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj 6//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -vk 7 8interface IFoo 9{ 10 static const This identity; 11} 12 13__generic<T:IFoo> 14extension T 15{ 16 This getIdentity() 17 { 18 return identity; 19 } 20} 21 22struct FooImpl : IFoo 23{ 24 int v = 1; 25 static const This identity = This(); 26} 27 28 29//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 30RWStructuredBuffer<int> outputBuffer; 31 32[numthreads(1, 1, 1)] 33void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 34{ 35 FooImpl foo = {}; 36 var ident = foo.getIdentity(); 37 // CHECK: 1 38 outputBuffer[0] = ident.v; 39}