diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-05-18 10:09:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-18 10:09:28 -0400 |
| commit | 1148564b9cdbbc8fec4fbecf65b0af60aa6af344 (patch) | |
| tree | fc5ca7629aed7e60797163c33deb56a4137249b4 /tests | |
| parent | d9fd0ff3f0fc7b775de1e05570f01798fbc8baa3 (diff) | |
Support for `[[vk::spirv_instruction(op)]]` (#2242)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Add extension required by SPIRVOpDecoration into part of emit (could be a prior pass).
* Add [[vk::spirv_instruction]] attribute
* Add documentation for [[vk::spirv_instruction].
* Update 08-attributes.md
* Update 08-attributes.md
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/spirv/spirv-instruction.slang | 17 | ||||
| -rw-r--r-- | tests/spirv/spirv-instruction.slang.expected.txt | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/spirv/spirv-instruction.slang b/tests/spirv/spirv-instruction.slang new file mode 100644 index 000000000..1f85479f9 --- /dev/null +++ b/tests/spirv/spirv-instruction.slang @@ -0,0 +1,17 @@ +// spirv-instruction.slang +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +// Test using a spirv op. 128 is SpvOpIAdd + +[[vk::spirv_instruction(128)]] +uint add(uint a, uint b); + +//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer<uint> resultBuffer; + +[numthreads(4,1,1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint threadId = dispatchThreadID.x; + resultBuffer[threadId] = add(threadId, threadId); +} diff --git a/tests/spirv/spirv-instruction.slang.expected.txt b/tests/spirv/spirv-instruction.slang.expected.txt new file mode 100644 index 000000000..e1e8ccec4 --- /dev/null +++ b/tests/spirv/spirv-instruction.slang.expected.txt @@ -0,0 +1,4 @@ +0 +2 +4 +6 |
