| 1 |
=================== |
| 2 |
HLSL Resource Types |
| 3 |
=================== |
| 4 |
|
| 5 |
.. contents:: |
| 6 |
:local: |
| 7 |
|
| 8 |
Introduction |
| 9 |
============ |
| 10 |
|
| 11 |
HLSL Resources are runtime-bound data that is provided as input, output or both |
| 12 |
to shader programs written in HLSL. Resource Types in HLSL provide key user |
| 13 |
abstractions for reading and writing resource data. |
| 14 |
|
| 15 |
Implementation Details |
| 16 |
====================== |
| 17 |
|
| 18 |
In Clang resource types are forward declared by the ``HLSLExternalSemaSource`` |
| 19 |
on initialization. They are then lazily completed when ``requiresCompleteType`` |
| 20 |
is called later in Sema. |
| 21 |
|
| 22 |
Resource types are classes that have the "intangible" resource handle type, |
| 23 |
`__hlsl_resource_t`, as a member. These are generally templated class |
| 24 |
declarations that specify the type of data that can be loaded from or stored |
| 25 |
into the resource. The handle is annotated with hlsl-specific attributes |
| 26 |
describing properties of the resource. Member functions of a resource type are |
| 27 |
generally fairly simple wrappers around builtins that operate on the handle |
| 28 |
member. |
| 29 |
|
| 30 |
During code generation resource types are lowered to target extension types in |
| 31 |
IR. These types are target specific and differ between DXIL and SPIR-V |
| 32 |
generation, providing the necessary information for the targets to generate |
| 33 |
binding metadata for their respective target runtimes. |