diff options
| author | Yong He <yonghe@outlook.com> | 2020-10-09 11:29:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-09 11:29:11 -0700 |
| commit | fab1c9f4c745ba84983c2448646376799d461e96 (patch) | |
| tree | 3176c03987417c01b7220aaf13c35b665813c876 /tests | |
| parent | 11f331771a8d5d80bc1dd317dcad5eb815e9cb55 (diff) | |
Support CUDA bindless texture in dynamic dispatch code. (#1575)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/dynamic-dispatch-bindless-texture.slang | 40 | ||||
| -rw-r--r-- | tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt | 4 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang b/tests/compute/dynamic-dispatch-bindless-texture.slang new file mode 100644 index 000000000..49265fac4 --- /dev/null +++ b/tests/compute/dynamic-dispatch-bindless-texture.slang @@ -0,0 +1,40 @@ +// Test using interface typed shader parameters with texture typed fields. +//TEST(compute):COMPARE_COMPUTE:-cpu +//TEST(compute):COMPARE_COMPUTE:-cuda + +[anyValueSize(8)] +interface IInterface +{ + float run(); +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer +RWStructuredBuffer<uint> gOutputBuffer; +//TEST_INPUT: Texture2D(size=8, content = one):name t2D,bindless +//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) handle(t2D) 0 0], stride=4):name=gCb +StructuredBuffer<IInterface> gCb; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + let tid = dispatchThreadID.x; + + let inputVal : int = tid; + IInterface v0 = gCb.Load(0); + SamplerState sampler; + let outputVal = v0.run(); + gOutputBuffer[tid] = trunc(outputVal); +} + +//TEST_INPUT: globalExistentialType __Dynamic + +// Type must be marked `public` to ensure it is visible in the generated DLL. +public struct MyImpl : IInterface +{ + Texture2D tex; + SamplerState sampler; + float run() + { + return tex.Sample(sampler, float2(0.0, 0.0)).x; + } +}; diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt b/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt new file mode 100644 index 000000000..98fb6a686 --- /dev/null +++ b/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt @@ -0,0 +1,4 @@ +1 +1 +1 +1 |
