diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-01-10 15:32:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-10 12:32:34 -0800 |
| commit | 4e7694fc862ad69b4746373d58fc7f2071385ca2 (patch) | |
| tree | fc4abdd9b714e686641b85501eb1658889c53e3b /tests/current-bugs | |
| parent | aee4aa3528072e4b5e95ccc4e571868716b47d50 (diff) | |
Test for dynamicDispatch/resource internal error (#2071)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Test for internal error with resource/dynamic dispatch.
* Fix typo.
Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests/current-bugs')
| -rw-r--r-- | tests/current-bugs/resource-dynamic-dispatch.slang | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/current-bugs/resource-dynamic-dispatch.slang b/tests/current-bugs/resource-dynamic-dispatch.slang new file mode 100644 index 000000000..0a987b1cf --- /dev/null +++ b/tests/current-bugs/resource-dynamic-dispatch.slang @@ -0,0 +1,67 @@ +//DISABLE_TEST:SIMPLE:-target dxil -entry computeMain -profile cs_6_2 + +/* Fails with: + +(0): internal error 99999: unimplemented feature in Slang compiler: unexpected IR opcode during code emit +*/ + +// Dynamic dispatch with a resource type +RWStructuredBuffer<float> outputBuffer; + +interface IGetTexture +{ + Texture2D<float> getTexture(); +}; + +struct SomeData : IGetTexture +{ + Texture2D<float> getTexture() { return tex; } + Texture2D<float> tex; +}; + +interface IInterface +{ + associatedtype Type; + IGetTexture getType(); +}; + +// Need public to make these conformances available +public struct A : IInterface +{ + typedef SomeData Type; + IGetTexture getType() { Type t = { gTexA }; return t; } +}; + +public struct B : IInterface +{ + typedef SomeData Type; + IGetTexture getType() { Type t = { gTexB }; return t; } +}; + +Texture2D<float> gTexA, gTexB; + + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + A a; + B b; + + IInterface intf; + + if (tid & 1) + { + intf = a; + } + else + { + intf = b; + } + + var getTex = intf.getType(); + let tex = getTex.getTexture(); + + outputBuffer[tid] = tex.Load(int3(tid, tid, 0)); +}
\ No newline at end of file |
