summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/attribute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir/attribute.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/attribute.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp
index 7993e5c43..4d0b8b8e5 100644
--- a/src/shader_recompiler/frontend/ir/attribute.cpp
+++ b/src/shader_recompiler/frontend/ir/attribute.cpp
@@ -20,6 +20,13 @@ u32 GenericAttributeIndex(Attribute attribute) {
return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::Generic0X)) / 4u;
}
+u32 GenericAttributeElement(Attribute attribute) {
+ if (!IsGeneric(attribute)) {
+ throw InvalidArgument("Attribute is not generic {}", attribute);
+ }
+ return static_cast<u32>(attribute) % 4;
+}
+
std::string NameOf(Attribute attribute) {
switch (attribute) {
case Attribute::PrimitiveId: