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
815 B37 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* Test here is to try and associate a value with a type
4
5Doesn't work 
6D:\local\Temp\a3393a41-6d61-4049-816b-4edcc04f47fb.slang(24): error 30027: 'kE' is not a member of 'overload group'.
7    let e = A::Type::kE;
8    
9The only change here was to make A implement IHasType    
10*/
11
12//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
13RWStructuredBuffer<int> outputBuffer;
14
15enum class Enum
16{
17    A, B
18};
19
20interface IHasType
21{
22    associatedtype Type;
23};
24
25struct A : IHasType
26{
27    typedef A Type;
28    static const Enum kE = Enum::A;
29};
30
31[numthreads(4, 1, 1)]
32void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
33{    
34    int index = dispatchThreadID.x;
35    let e = A::Type::kE;    
36    outputBuffer[index] = int(e);
37}