DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] Why is the `vk::BufferPointer` itself getting loaded with `Align 4` ?

Open devshgraphicsprogramming opened this issue 5 months ago • 2 comments

Description

I was putting a vk::BufferPointer in a Push Constant struct.

Steps to Reproduce

https://godbolt.org/z/9eMrbqe3W

Actual Behavior

In the SPIR-V the pointer itself (not the value it points to) gets OpLoaded with extra Aligned 4 operands.

There are a few things wrong with this:

  1. AFAIK only PhysicalStorageBuffer storage class pointers can be used for OpLoad/OpStore which has an extra Aligned operand, the access chain from which it gets loaded is in OpTypePointer PushConstant
  2. Even if the above were legal, the Aligned 4 is wrong because the alignment of a BDA is 8

Given (1) I'm surprised SPIR-V Validator hasn't screamed about this.

Environment

  • DXC version
  • Host Operating System

@danbrown-amd

Looks like @danbrown-amd is working on this.

s-perron avatar Jun 24 '25 20:06 s-perron