diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/serialization/serialized-module-test.slang | 35 | ||||
| -rw-r--r-- | tests/serialization/serialized-module-test.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/serialization/serialized-module.slang | 15 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/serialization/serialized-module-test.slang b/tests/serialization/serialized-module-test.slang new file mode 100644 index 000000000..63c31e039 --- /dev/null +++ b/tests/serialization/serialized-module-test.slang @@ -0,0 +1,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); +} diff --git a/tests/serialization/serialized-module-test.slang.expected.txt b/tests/serialization/serialized-module-test.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/serialization/serialized-module-test.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/tests/serialization/serialized-module.slang b/tests/serialization/serialized-module.slang new file mode 100644 index 000000000..e94edf8d4 --- /dev/null +++ b/tests/serialization/serialized-module.slang @@ -0,0 +1,15 @@ +//TEST_IGNORE_FILE: + +// serialized-module.slang + +struct Thing +{ + int a; + int b; +}; + +int foo(Thing thing) +{ + return (thing.a + thing.b) - thing.b; +} + |
