Skip to content

[HLSL] Implement GetDimensions methods for buffer resources #112984

@hekota

Description

@hekota

Implement GetDimensions methods on all buffer resources based on proposal llvm/wg-hlsl#346.

  • Introduce Clang builtin function(s) based on the proposal.
  • Lower the builtin calls to llvm.dx.resource.getdimensions and read the arguments back.
  • Implement GetDimensions methods for buffers in HLSLBuildinTypeDeclBuilder and add them to all resource buffers

Applieds to:

StructuredBuffer
RWStructuredBuffer
RasterizerOrderedStructuredBuffer
AppendStructuredBuffer
ConsumeStructuredBuffer
RWBuffer
ByteAddressBuffer
{RW}ByteAddressBuffer

Docs:
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-object-structuredbuffer-getdimensions
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-object-rwbuffer-getdimensions
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-object-rwbyteaddressbuffer-getdimensions

Example:
https://godbolt.org/z/bz7zxsf5n

Depends on: #112982

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

No type

Projects

Status

Active

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions