Skip to content

[DirectX] Start documenting DXIL Resource handling #90553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions clang/docs/HLSL/HLSLIRReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ Introduction
The goal of this document is to provide a reference for all the special purpose
IR metadata and attributes used by the HLSL code generation path.

IR Metadata
===========

``hlsl.uavs``
-------------

The ``hlsl.uavs`` metadata is a list of all the external global variables that
represent UAV resources.

Function Attributes
===================

Expand Down
25 changes: 12 additions & 13 deletions clang/docs/HLSL/ResourceTypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ In Clang resource types are forward declared by the ``HLSLExternalSemaSource``
on initialization. They are then lazily completed when ``requiresCompleteType``
is called later in Sema.

Resource types are templated class declarations. The template parameter
specifies the expected return type of resource loads, and the expected parameter
type for stores.

In Clang's AST and code generation, resource types are classes that store a
pointer of the template parameter type. The pointer is populated from a call to
``__builtin_hlsl_create_handle``, and treated as a pointer to an array of typed
data through until lowering in the backend.

Resource types are annotated with the ``HLSLResource`` attribute, which drives
code generation for resource binding metadata. The ``hlsl`` metadata nodes are
transformed in the backend to the binding information expected by the target
runtime.
Resource types are classes that have the "intangible" resource handle type,
`__hlsl_resource_t`, as a member. These are generally templated class
declarations that specify the type of data that can be loaded from or stored
into the resource. The handle is annotated with hlsl-specific attributes
describing properties of the resource. Member functions of a resource type are
generally fairly simple wrappers around builtins that operate on the handle
member.

During code generation resource types are lowered to target extension types in
IR. These types are target specific and differ between DXIL and SPIR-V
generation, providing the necessary information for the targets to generate
binding metadata for their respective target runtimes.
Loading
Loading