aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorReinUsesLisp <[email protected]>2021-02-07 23:48:44 -0300
committerReinUsesLisp <[email protected]>2021-02-07 23:52:40 -0300
commitcae2725cc0abb9cea23ebbf72c990a86f802ab4b (patch)
treedcb030767c4850a0d9ccffacc512d8522011baf0 /include
parentab567491e15aa5c94d6e64956f46d7896583f321 (diff)
downloadsirit-cae2725cc0abb9cea23ebbf72c990a86f802ab4b.tar.gz
sirit-cae2725cc0abb9cea23ebbf72c990a86f802ab4b.zip
Add overload for decorating with enums
Skip an explicit cast on the caller, allowing code like: Decorate(some_op, spv::Decoration::BuiltIn, spv::BuiltIn::WorkgroupId)
Diffstat (limited to 'include')
-rw-r--r--include/sirit/sirit.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h
index d7dfc78..781f84a 100644
--- a/include/sirit/sirit.h
+++ b/include/sirit/sirit.h
@@ -368,6 +368,13 @@ public:
return Decorate(target, decoration, std::span<const Literal>{stack_literals});
}
+ /// Add a decoration to target.
+ template <typename T>
+ requires std::is_enum_v<T>
+ Id Decorate(Id target, spv::Decoration decoration, T literal) {
+ return Decorate(target, decoration, static_cast<std::uint32_t>(literal));
+ }
+
Id MemberDecorate(Id structure_type, Literal member, spv::Decoration decoration,
std::span<const Literal> literals = {});