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