microsoft / microsoft/DirectXShaderCompiler
[Feature Request] Allow non-literal constants in attributes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Is your feature request related to a problem? Please describe.
I've tried numerous times to make the [[]vk::]] attributes depend on a template parameter or some other const expression, each time I thought its a general C++/Clang limitation.
https://github.com/microsoft/DirectXShaderCompiler/issues/6541
https://github.com/microsoft/DirectXShaderCompiler/issues/6584
Theres a few other issues I can't find right now which also showcased attempts at putting constant expressions into attributes.
But turns out its not: https://godbolt.org/z/he94bcGfr
Describe the solution you'd like
Being able to specify attribute arguments/parameters from constexpr (static const) variables and enums.
Describe alternatives you've considered
Nothing
Additional context
None
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 by reviewing the linked HLSL specs issue location and the related DirectXShaderCompiler issues 6541 and 6584, then compare the Godbolt example. Clarify the intended constexpr, static const, and enum cases for attribute arguments, and define the language-specification and compiler behavior that would count as complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100