yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
810 B42 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* A test for equality around interface types
4
5This does work. 
6
7It is here, because it seems like an awkward to do things, and only applys to struct like types.
8 */
9
10//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
11RWStructuredBuffer<float> outputBuffer;
12
13interface IEquality
14{
15    associatedtype Type;
16    bool isEqual(Type rhs);
17};
18
19struct A : IEquality
20{
21    typedef A Type;
22    bool isEqual(IEquality rhs)
23    {
24        return value == rhs.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