diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-11-18 18:12:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-18 18:12:43 -0500 |
| commit | e140c4950eb8c69606386ca57284c0655513b9e1 (patch) | |
| tree | 1361dcf8cfc1597b63960226006af301ac82bfc6 /tests/serialization | |
| parent | d898d561e3c76ecf38db434ec7fbb4bbd0e25cb2 (diff) | |
Test for serializing out and reading back Stdlib (#1605)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Mangling/module name extraction for GenericDecl
* Add comment on SerialFilter to explain re-enabling Stmt.
* Support setting up SyntaxDecl when reconstructed after deserialization.
* Improvements to setup SyntaxDecl.
* Fix typo so can read compressed SourceLocs.
* Fix issue with SourceManger.
* Simple test for serializing out stdlib and reading back in.
* Fix calling convention.
* Add override to StdLib impls.
* Fix typo.
* Apply testing to an actual compute test when using load-stdlib
Make -load/compile-stdlib processable by Slang
Move out testing into util into TestToolUtil so can be shared.
* Slightly more concise setup of session.
* Fix some errors introduced with session handling.
* Made setup for compile same across slangc and slangc-tool.
Diffstat (limited to 'tests/serialization')
| -rw-r--r-- | tests/serialization/std-lib-serialize.slang | 32 | ||||
| -rw-r--r-- | tests/serialization/std-lib-serialize.slang.expected.txt | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/serialization/std-lib-serialize.slang b/tests/serialization/std-lib-serialize.slang new file mode 100644 index 000000000..e55a2cd69 --- /dev/null +++ b/tests/serialization/std-lib-serialize.slang @@ -0,0 +1,32 @@ +//TEST:COMPILE: -save-stdlib +//TEST:COMPARE_COMPUTE: -compile-arg -load-stdlib + +struct A +{ + float x; + + float addWith(float y) + { + return this.x + y; + } +}; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer : register(u0); + + +float test(float inVal) +{ + A a; + a.x = inVal; + return a.addWith(inVal*inVal); +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + float inVal = float(tid); + float outVal = test(inVal); + outputBuffer[tid] = outVal; +}
\ No newline at end of file diff --git a/tests/serialization/std-lib-serialize.slang.expected.txt b/tests/serialization/std-lib-serialize.slang.expected.txt new file mode 100644 index 000000000..f73cfe6c3 --- /dev/null +++ b/tests/serialization/std-lib-serialize.slang.expected.txt @@ -0,0 +1,4 @@ +0 +40000000 +40C00000 +41400000 |
