DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] sizeof(vk::BufferPointer) is not supported

Open Dolkar opened this issue 1 month ago • 3 comments

Description See title. This is necessary to support manual indexing through pointer arithmetic when the stored type itself contains a vk::BufferPointer. I don't think there should be any problems with it - afaik the stored address is always expected to be 64-bit.

Steps to Reproduce https://godbolt.org/z/aTf8r4Wza

Actual Behavior

<source>:8:20: error: invalid application of 'sizeof' to non-numeric type 'vk::BufferPointer<int>'
    intBuf.Get() = sizeof(vk::BufferPointer<int>);

Environment

  • DXC version: trunk
  • Host Operating System: Windows 11

Dolkar avatar Dec 10 '25 17:12 Dolkar

Btw you can spirv bitcast between vk:: BufferPointer and uint64_t and uint32_t2

The Spir-V spec does indeed state that a buffer reference has same size and alignment as a uint64_t, IIRC

Btw you can spirv bitcast between vk:: BufferPointer and uint64_t and uint32_t2

You can (even without inline spirv), but storing pointers as plain uints breaks BDA integration in tools like RenderDoc.

Dolkar avatar Dec 10 '25 23:12 Dolkar

Btw you can spirv bitcast between vk:: BufferPointer and uint64_t and uint32_t2

You can (even without inline spirv), but storing pointers as plain uints breaks BDA integration in tools like RenderDoc.

yea, great point actually