diff options
| author | Theresa Foley <10618364+tangent-vector@users.noreply.github.com> | 2024-08-22 11:54:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-22 11:54:27 -0700 |
| commit | e4088cd602bd4d5a72fea67a787b1319acfc044d (patch) | |
| tree | 12fcbfbb4f13a227401ce4a1c25123d7c6fa0d89 /docs/language-reference/08-attributes.md | |
| parent | b5bb82411cc6101b66283f7d0abca7ceb58aa2f6 (diff) | |
Add skeleton of a language reference. (#4808)
The files being checked in here were initially written 2-3 years ago.
They are very clearly incomplete, outdated and, quite often, inaccurate.
The intention of this change is to get an initial skeleton in place for
the large-scale structure of a language reference (for now avoiding
the term "specification" and all the weight it carries).
Future commits should be able to add to flesh out this skeleton and
start to make the document more complete and more accurate.
Diffstat (limited to 'docs/language-reference/08-attributes.md')
| -rw-r--r-- | docs/language-reference/08-attributes.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/language-reference/08-attributes.md b/docs/language-reference/08-attributes.md new file mode 100644 index 000000000..7ffe0f0fe --- /dev/null +++ b/docs/language-reference/08-attributes.md @@ -0,0 +1,32 @@ +> Note: This document is a work in progress. It is both incomplete and, in many cases, inaccurate. + +Attributes +========== + +> Note: This section is not yet complete. + +## [[vk::spirv_instruction]] + +** SPIR-V only ** + +This attribute is only available for Vulkan SPIR-V output. + +The attibute allows access to SPIR-V intrinsics, by supplying a function declaration with the appropriate signature for the SPIR-V op and no body. The intrinsic takes a single parameter which is the integer value for the SPIR-V op. + +In the example below the add function, uses the mechanism to directly use the SPIR-V integer add 'op' which is 128 in this case. + +```HLSL +// 128 is OpIAdd in SPIR-V +[[vk::spirv_instruction(128)]] +uint add(uint a, uint b); + +RWStructuredBuffer<uint> resultBuffer; + +[numthreads(4,1,1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint threadId = dispatchThreadID.x; + resultBuffer[threadId] = add(threadId, threadId); +} +``` + |
