Skip to content

[HLSL] Introduce builtins to index into HLSLResource types #95956

Closed
@bogner

Description

@bogner

We need a builtin in clang that can operate on HLSLResource builtin types to index into them. This should look like __builtin_hlsl_resource_getpointer(__hlsl_resource_t Handle, uint Index) and return a reference in the HLSL device address space, so that we can later transform this to the appropriate loads and stores of the resource at the DXIL and SPIR-V levels. We'll need to wire up the operator[] in resources to call this builtin.

We will also want a builtin for directly loading from a resource, a la __builtin_hlsl_resource_load(__hlsl_resource_t Handle, uint Index, out uint Status). This will return the loaded value of the resource and also the status bit for CheckAccessFullyMapped. The Load() functions in resources should call this builtin.

AC:

  • These builtins are available and lower to appropriate LLVM DirectX intrinsics during clang codegen
  • Array subscript operators for HLSL resource types have been implemented using these builtins

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions