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
803 B35 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* Test is to try and see what effects type constraints have. 
4
5This is a bit of a silly example.
6
7Fails with 
8
9.slang(23): note 99999: an internal error threw an exception while working on code near this location
10(0): error 99999: Slang compilation aborted due to an exception of class Slang::InternalError: unimplemented: value lowering
11
12*/
13
14//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
15RWStructuredBuffer<int> outputBuffer;
16
17enum XXX {};
18
19__generic<T : XXX>
20Enum getEnum(T i)
21{
22    return Enum::A;
23}
24
25
26[numthreads(4, 1, 1)]
27void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
28{    
29    int index = dispatchThreadID.x;
30    
31    XXX x;
32    let e = getEnum(x);
33
34    outputBuffer[index] = int(e);
35}