Issue 95956
Summary [HLSL] Introduce builtins to index into HLSLResource types
Labels HLSL
Assignees
Reporter bogner
    We need a builtin in clang that can operate on HLSLResource builtin types to index into them. There are two approaches to this:

1. Have `__builtin_hlsl_resource_index(resource_t x)` return a pointer to the underlying type, which we then load and store directly
2. Have `__builtin_hlsl_resource_index(resource_t x)` return another `resource_t`, and introduce `__builtin_hlsl_resource_load` and `__builtin_hlsl_resource_store` as well.

Option (1) is probably sufficient and simpler for the `dx.RawBuffer` types (StructuredBuffers and ByteAddressBuffers), but it may be harder to form the right operations for `dx.TypedBuffer` and `dx.CBuffer` types. Option (2) is more complex and should be used if option (1) is found to be untenable.

AC:
- These builtins are available and lower to DXIL intrinsics during clang codegen
- Array subscript operators for HLSL resource types can be implemented using these builtins
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to