diff options
| author | Yong He <yonghe@outlook.com> | 2024-08-01 10:56:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-01 10:56:47 -0700 |
| commit | 69dd7f40efd4988ba0fe3d4d5f6fee2d4d5d4a87 (patch) | |
| tree | 2ab3aee0a8e6fea3223496afe92700d9f95394e5 /tests/language-feature/interfaces | |
| parent | 32b843215b2e80c23c1fbcf02150c52a6304a447 (diff) | |
Perform type legalization on StructuredBuffer element. (#4767)
Diffstat (limited to 'tests/language-feature/interfaces')
| -rw-r--r-- | tests/language-feature/interfaces/empty-type-conformance.slang | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/language-feature/interfaces/empty-type-conformance.slang b/tests/language-feature/interfaces/empty-type-conformance.slang new file mode 100644 index 000000000..9fee04607 --- /dev/null +++ b/tests/language-feature/interfaces/empty-type-conformance.slang @@ -0,0 +1,27 @@ +// Test that we allow empty type conformances. + +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-dx11 -compute -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -output-using-type + +interface TestInterface { + float sample(); +} +struct TestImplementation : TestInterface { + float sample() { + return 1.0f; + } +}; + +//TEST_INPUT: set inBuffer = new StructuredBuffer<TestInterface>[new TestImplementation{}]; +StructuredBuffer<TestInterface> inBuffer; + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4); +RWStructuredBuffer<float> outputBuffer; + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + // CHECK: 1.0 + outputBuffer[0] = inBuffer[0].sample(); +}
\ No newline at end of file |
