diff options
Diffstat (limited to 'tests')
| -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 |
