summaryrefslogtreecommitdiffstats
path: root/tests/serialization/serialized-module-test.slang
blob: 63c31e039c587c01634656256984792239d68534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// serialized-module-test.slang

// A test to try out the basics of module
// serialization.

//TEST:SIMPLE_EX: tests/serialization/serialized-module.slang -o tests/serialization/serialized-module.slang-module
//TEST:COMPARE_COMPUTE_EX:-slang -compute -xslang -r -xslang tests/serialization/serialized-module.slang-module

//import serialized_module;

// This is fragile - needs match the definition in serialized_module
struct Thing
{
    int a;
    int b;
};

// TODO: need to get the name mangling to line up!
int foo(Thing thing);

//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):dxbinding(0),glbinding(0),out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    Thing thing;

    int index = (int)dispatchThreadID.x;
        
    thing.a = index;
    thing.b = -index;

    outputBuffer[index] = foo(thing);
}