yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8a15efb37
master
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -entry computeMain -stage compute 2 3enum A 4{ 5 V1, 6 V2, 7 V3 8} 9 10enum B 11{ 12 V1, 13 V2, 14 V3 15} 16 17struct Foo<T, A access = A::V1, B addrSpace = B::V1> 18{ 19 int a; 20 __init(int b) { a = b; } 21 __init<U, A accessOther>(Foo<U, accessOther, addrSpace> ptr) 22 { 23 } 24 25 // internally Slang is throwing an error, we just don't drain the error 26 // from our sink 27 __init(uint64_t val) {} 28 __init(int64_t val) {} 29} 30 31extension int64_t 32{ 33 __init<T, A access, B addrSpace>(Foo<T, access, addrSpace> t) {} 34} 35extension uint64_t 36{ 37 __init<T, A access, B addrSpace>(Foo<T, access, addrSpace> t) {} 38} 39 40RWStructuredBuffer<int> output; 41 42[shader("compute")] 43[numthreads(1, 1, 1)] 44void computeMain(uint3 threadId: SV_DispatchThreadID) 45{ 46 Foo<int, A.V1, B.V1> v1 = Foo<int, A.V1, B.V1>(1); 47 48 // CHECK: ([[# @LINE+1]]): error 30080 49 Foo<float, A.V1, B.V2> v2 = Foo<float, A.V1, B.V2>(v1); 50 51 output[0] = v1.a; 52}