microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] Enum class bitfields are emitted into separate storage slots
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
DXC does not treat enum class bitfields as a plain integer type, which can cause the enum class-typed bitfield (type) to be placed into its own 32-bit storage slot instead of being packed with the following bitfields. This may lead to a larger-than-expected struct layout and prevents full bitfield packing.
Steps to Reproduce
https://godbolt.org/z/Ga61357fn In this example, the generated struct is 12 bytes instead of 8.
Related issue: https://github.com/microsoft/DirectXShaderCompiler/issues/5554
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Compiler Explorer reproduction at https://godbolt.org/z/Ga61357fn and compare its generated layout with the related issue #5554. Trace how DXC lowers enum class-typed bitfields for SPIR-V and identify the storage-slot decision. Done means the enum class bitfield is packed with the following bitfields and the reproduced struct layout is 8 bytes rather than 12.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100