diff options
| author | Yong He <yonghe@outlook.com> | 2020-09-02 12:21:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-02 12:21:28 -0700 |
| commit | a2a7c4d988b2b7126130d9dcbe4ec94e1ce8424b (patch) | |
| tree | 5e9559abd79b9e2f7d4f22f65a77daaaae3eed16 /tests | |
| parent | 7f567df6937b33c653c424af3abb20d32eb80561 (diff) | |
Allow unspecialized existential shader parameters (dynamic dispatch). (#1529)
* Allow unspecialized existential shader parameters (dynamic dispatch).
* Fixes.
* Fixes
* disable cuda test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/dynamic-dispatch-11.slang | 38 | ||||
| -rw-r--r-- | tests/compute/dynamic-dispatch-11.slang.expected.txt | 4 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/compute/dynamic-dispatch-11.slang b/tests/compute/dynamic-dispatch-11.slang new file mode 100644 index 000000000..18b416697 --- /dev/null +++ b/tests/compute/dynamic-dispatch-11.slang @@ -0,0 +1,38 @@ +// Test using interface typed shader parameters with dynamic dispatch. + +//TEST(compute):COMPARE_COMPUTE:-cpu -xslang -disable-specialization +//DISABLE_TEST(compute):COMPARE_COMPUTE:-cuda -xslang -disable-specialization + +[anyValueSize(8)] +interface IInterface +{ + int run(int input); +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer +RWStructuredBuffer<int> gOutputBuffer; + +//TEST_INPUT:cbuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) 1 0], stride=4):name=gCb +ConstantBuffer<IInterface> gCb; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + let tid = dispatchThreadID.x; + + let inputVal : int = tid; + let outputVal = gCb.run(inputVal); + + gOutputBuffer[tid] = outputVal; +} + +// No type input for dynamic dispatch //TEST_INPUT: globalExistentialType MyImpl +// Type must be marked `public` to ensure it is visible in the generated DLL. +public struct MyImpl : IInterface +{ + int val; + int run(int input) + { + return input + val; + } +}; diff --git a/tests/compute/dynamic-dispatch-11.slang.expected.txt b/tests/compute/dynamic-dispatch-11.slang.expected.txt new file mode 100644 index 000000000..94ebaf900 --- /dev/null +++ b/tests/compute/dynamic-dispatch-11.slang.expected.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 |
