diff options
| author | Yong He <yonghe@outlook.com> | 2022-07-21 22:52:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-21 22:52:27 -0700 |
| commit | 73b52f6075eb8a4f674e5d66d2a6192ca71f26d3 (patch) | |
| tree | 0fb7fbea8356323dcb0ac4173cf2fc97c02d3fcf /tests | |
| parent | 91c8c3f32c4b827dedc74d2ecdfe72a3403fc357 (diff) | |
Allow dynamic dispatch to handle nested interface-typed fields. (#2336)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/nested-existential-dyndispatch.slang | 56 | ||||
| -rw-r--r-- | tests/bugs/nested-existential-dyndispatch.slang.expected.txt | 5 |
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/bugs/nested-existential-dyndispatch.slang b/tests/bugs/nested-existential-dyndispatch.slang new file mode 100644 index 000000000..b6689b54d --- /dev/null +++ b/tests/bugs/nested-existential-dyndispatch.slang @@ -0,0 +1,56 @@ +//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<float> outputBuffer; + +interface IFoo +{ + float sample(); +} + +//TEST_INPUT: type_conformance Bar:IBar = 0 +[anyValueSize(64)] +interface IBar +{ + float sample(); +} + +//TEST_INPUT: type_conformance Foo:IFoo = 0 +struct Foo : IFoo +{ + float3 albedo; + float sample() + { + return albedo.x; + } +} + +struct Bar : IBar +{ + IFoo foo; + float sample() + { + return foo.sample(); + } +} + +struct AnyVal +{ + uint data[16]; +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + + Foo f; + f.albedo = float3(1.0); + Bar bar; + bar.foo = f; + + AnyVal data = reinterpret<AnyVal, Bar>(bar); + IBar dynBar = createDynamicObject<IBar, AnyVal>(0, data); + + outputBuffer[index] = dynBar.sample(); +} diff --git a/tests/bugs/nested-existential-dyndispatch.slang.expected.txt b/tests/bugs/nested-existential-dyndispatch.slang.expected.txt new file mode 100644 index 000000000..24e3a50ad --- /dev/null +++ b/tests/bugs/nested-existential-dyndispatch.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +1.0 +1.0 +1.0 +1.0
\ No newline at end of file |
