diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/interface-shader-param-legalization.slang | 54 | ||||
| -rw-r--r-- | tests/compute/interface-shader-param-legalization.slang.expected.txt | 4 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/compute/interface-shader-param-legalization.slang b/tests/compute/interface-shader-param-legalization.slang new file mode 100644 index 000000000..8c63d81ac --- /dev/null +++ b/tests/compute/interface-shader-param-legalization.slang @@ -0,0 +1,54 @@ +// interface-shader-param-legalization.slang + +// Test case where concrete type implementing +// an interface has resource-type fields nested in it. + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute + +interface IModifier +{ + int modify(int val); +} + +IModifier gModifier; + +int test( + int val) +{ + return gModifier.modify(val); +} + + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out +RWStructuredBuffer<int> gOutputBuffer; + +[numthreads(4, 1, 1)] +void computeMain( + uint3 dispatchThreadID : SV_DispatchThreadID) +{ + let tid = dispatchThreadID.x; + + let inputVal : int = tid; + let outputVal = test(inputVal); + + gOutputBuffer[tid] = outputVal; +} + +// Now that we've define all the logic of the entry point, +// we will define some concrete types that we can plug +// in for the interface-type parameters. + +struct ConcreteData +{ + int offset; +} + +struct ConcreteModifier : IModifier +{ + ConstantBuffer<ConcreteData> data; + + int modify(int val) { return val + data.offset; } +} + +//TEST_INPUT: globalExistentialType ConcreteModifier +//TEST_INPUT:cbuffer(data=[256], stride=4):dxbinding(0),glbinding(0),out diff --git a/tests/compute/interface-shader-param-legalization.slang.expected.txt b/tests/compute/interface-shader-param-legalization.slang.expected.txt new file mode 100644 index 000000000..f94894bb2 --- /dev/null +++ b/tests/compute/interface-shader-param-legalization.slang.expected.txt @@ -0,0 +1,4 @@ +100 +101 +102 +103 |
