yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
160111a0e
master
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 2 3/* A test for equality around interface types 4 5This style is discussed in the documentation here (on This type): 6 7https://github.com/shader-slang/slang/blob/master/docs/user-guide/04-interfaces-generics.md 8 9Still has limitiation that it only works for an an implementation of an interface. 10 */ 11 12//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 13RWStructuredBuffer<float> outputBuffer; 14 15interface IEquality 16{ 17 bool isEqual(This other); 18} 19 20struct A : IEquality 21{ 22 bool isEqual(This other) 23 { 24 return value == other.value; 25 } 26 int value; 27}; 28 29[numthreads(4, 1, 1)] 30void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 31{ 32 int index = dispatchThreadID.x; 33 34 A a = { 1 }; 35 A b = { 2 }; 36 37 bool isEqual = a.isEqual(b); 38 39 outputBuffer[index] = 1 + int(isEqual); 40} 41 42