microsoft / microsoft/DirectXShaderCompiler
[Feature Request] [SPIR-V] `vk::ext_decorate` on return types of Inline SPIR-V Intrinsics or functions In general
@luciechoi is already working on this.
Since Apr 2, 2026.
- 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.
In SPIR-V certain Result IDs (immediate SSA values) can be OpDecorated with very useful things like:
Uniform/UniformID, basically the reverse ofnonUniformEXT- SPV_EXT_float_control2 decorations allow decorating expressions
Describe the solution you'd like
I'd like to do this https://godbolt.org/z/a1xnsnord
template<typename T>
[[vk::ext_instruction(/*spv::OpCopyObject*/83)]]
[[vk::ext_decorate(/*spv::DecorationUniform*/26)]]
T decorateExpression(T v);
which should be enough to decorate things like FMul and so on.
But this is not sufficient
template<typename T>
[[vk::ext_decorate(/*spv::DecorationUniform*/26)]]
T decorateExpression(T v)
{
return v;
}
because certain decorations need to be applied directly to some SPIR-V instruction like mul,add.
Here's the SPIR-V I'd like to arrive at
https://godbolt.org/z/o6z9f6GYc
Describe alternatives you've considered
Ideally I'd love to be able to just decorate a statement.
However I know that even in latest trunk Clang statements cannot have attributes and thats a future C++ proposal
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3093r0.html
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.
Assessment
This issue has not been assessed yet.