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
878 B43 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* A test for equality around interface types
4
5Doesn't work because
6
7.slang(8): error 38100: type 'A' does not provide required interface member 'isEqual'
8struct A : IEquality
9           ^~~~~~~~~
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(IEquality rhs);
18};
19
20struct A : IEquality
21{
22    bool isEqual(IEquality rhs)
23    {
24        // Hmm. How can I cant query rhs, and then cast, so not clear how to implement
25        return true;
26    }
27    int value;
28};
29
30[numthreads(4, 1, 1)]
31void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
32{
33    int index = dispatchThreadID.x;
34
35    A a = { 1 };
36    A b = { 2 };
37    
38    bool isEqual = a.isEqual(b);
39
40	outputBuffer[index] = 1 + int(isEqual);
41}
42
43