Skip to content

Set the layout rule explicitly for raw buffer operations - #6701

Merged
Steven Perron (s-perron) merged 1 commit into
microsoft:mainfrom
s-perron:i6554
Jun 25, 2024
Merged

Steven Perron (s-perron) merged 1 commit into
microsoft:mainfrom
s-perron:i6554

Conversation

@s-perron

Copy link
Copy Markdown
Collaborator

The first first fix in #5392 was not correct. It relied on the layout
rule for the address to be the correct layout rule, but that is not
always the case. The address is just an integer that could exist in any
storage class. The correct solution is to explicitly set the layout rule
for the BitCast operation when expanding the RawBuffer* functions. We
know that the result of the BitCast is a pointer to the physical storage
buffer storage class, so we know the layout need to be the storage
buffer layout.

Fixes #6554

The first first fix in microsoft#5392 was not correct. It relied on the layout
rule for the address to be the correct layout rule, but that is not
always the case. The address is just an integer that could exist in any
storage class. The correct solution is to explicitly set the layout rule
for the BitCast operation when expanding the RawBuffer* functions. We
know that the result of the BitCast is a pointer to the physical storage
buffer storage class, so we know the layout need to be the storage
buffer layout.

Fixes microsoft#6554
@devshgraphicsprogramming

Copy link
Copy Markdown

Does this also fix #6541 ?

@s-perron

Steven Perron (s-perron) commented Jun 21, 2024 •

Copy link
Copy Markdown
Collaborator Author

Does this also fix #6541 ?

No, it does not. They are similar in that the layout of the BitCast is wrong, but different because with the inline spir-v, the compiler does not know what the layout should be.

@s-perron
Steven Perron (s-perron) merged commit e5183a0 into microsoft:main Jun 25, 2024
Mxr (SjMxr233) pushed a commit to ShaderHelper/DirectXShaderCompiler that referenced this pull request Jul 24, 2025
)

The first first fix in microsoft#5392 was not correct. It relied on the layout
rule for the address to be the correct layout rule, but that is not
always the case. The address is just an integer that could exist in any
storage class. The correct solution is to explicitly set the layout rule
for the BitCast operation when expanding the RawBuffer* functions. We
know that the result of the BitCast is a pointer to the physical storage
buffer storage class, so we know the layout need to be the storage
buffer layout.

Fixes microsoft#6554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[SPIR-V] RawBufferStore still trips up on missing member offsets

4 participants