diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-13 18:58:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-13 18:58:05 -0700 |
| commit | 05f9aaf6a4ef246dcf89b00000a8e59e90c47662 (patch) | |
| tree | f4c94d339066c9700bf0d806acd2b6d2647f3256 /tests/bugs/interface-type-self-ref.slang | |
| parent | f216b77752b9e4aea52882b2110ceb1cc64a2171 (diff) | |
Allow interface requirements to reference to the interface type itself. (#2398)
* Allow interface requirements to reference to the interface type itself.
* add comment explaining the change.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bugs/interface-type-self-ref.slang')
| -rw-r--r-- | tests/bugs/interface-type-self-ref.slang | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/bugs/interface-type-self-ref.slang b/tests/bugs/interface-type-self-ref.slang new file mode 100644 index 000000000..e3b1fe7cc --- /dev/null +++ b/tests/bugs/interface-type-self-ref.slang @@ -0,0 +1,32 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +interface IFoo +{ + int compute(out IFoo param); +} + +struct Impl : IFoo +{ + int compute(out IFoo param) + { + param = this; + return 0; + } +} + +int f(IFoo p) +{ + IFoo r; + return p.compute(r); +} + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + Impl impl; + outputBuffer[index] = f(impl); +} |
