diff options
Diffstat (limited to 'tests/optimization')
| -rw-r--r-- | tests/optimization/func-resource-result/func-resource-result-simple.slang | 31 | ||||
| -rw-r--r-- | tests/optimization/func-resource-result/func-resource-result-simple.slang.expected.txt | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/optimization/func-resource-result/func-resource-result-simple.slang b/tests/optimization/func-resource-result/func-resource-result-simple.slang new file mode 100644 index 000000000..5bebd69ac --- /dev/null +++ b/tests/optimization/func-resource-result/func-resource-result-simple.slang @@ -0,0 +1,31 @@ +// func-resource-result-simple.slang + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute + +// Test that a function that returns a resource type can be +// compiled for targets that don't natively support resource +// return values. + +//TEST_INPUT:ubuffer(data=[0x11 0x22 0x33 0x44], stride=4):name=inputBuffer +RWStructuredBuffer<int> inputBuffer; + +RWStructuredBuffer<int> getInputBuffer() { return inputBuffer; } + +int test(int val) +{ + return getInputBuffer()[val]; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int inVal = tid; + int outVal = test(inVal); + outputBuffer[tid] = outVal; +} diff --git a/tests/optimization/func-resource-result/func-resource-result-simple.slang.expected.txt b/tests/optimization/func-resource-result/func-resource-result-simple.slang.expected.txt new file mode 100644 index 000000000..e4511c4c7 --- /dev/null +++ b/tests/optimization/func-resource-result/func-resource-result-simple.slang.expected.txt @@ -0,0 +1,4 @@ +11 +22 +33 +44 |
