yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAdd slangc interface to compile and use ir modules. (#3615)401d8cdb1

master
842 B30 linesraw
1// serialized-module-test.slang
2
3// A test to try out the basics of module
4// serialization.
5
6//TEST:COMPILE: tests/serialization/serialized-module.slang -o tests/serialization/serialized-module.slang-module
7//TEST:COMPARE_COMPUTE_EX:-slang -compute -xslang -r -xslang tests/serialization/serialized-module.slang-module -shaderobj
8
9//import serialized_module;
10
11// This is fragile - needs match the definition in serialized_module
12import serialized_module_shared;
13
14extern int foo(Thing thing);
15
16//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):out,name outputBuffer
17RWStructuredBuffer<int> outputBuffer;
18
19[numthreads(4, 1, 1)]
20void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
21{
22    Thing thing;
23
24    int index = (int)dispatchThreadID.x;
25        
26    thing.a = index;
27    thing.b = -index;
28
29    outputBuffer[index] = foo(thing);
30}