diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.cpp | 8 | ||||
-rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.h | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp index 4d0b8b8e5c..dc2bec06db 100644 --- a/src/shader_recompiler/frontend/ir/attribute.cpp +++ b/src/shader_recompiler/frontend/ir/attribute.cpp @@ -9,6 +9,14 @@ namespace Shader::IR { +u32 TxtCoordAttributeIndex(Attribute attribute) { + return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::FixedFncTexture0S)) / 4u; +} + +u32 TxtCoordAttributeElement(Attribute attribute) { + return static_cast<u32>(attribute) % 4; +} + bool IsGeneric(Attribute attribute) noexcept { return attribute >= Attribute::Generic0X && attribute <= Attribute::Generic31X; } diff --git a/src/shader_recompiler/frontend/ir/attribute.h b/src/shader_recompiler/frontend/ir/attribute.h index ca11994943..6957fb43b9 100644 --- a/src/shader_recompiler/frontend/ir/attribute.h +++ b/src/shader_recompiler/frontend/ir/attribute.h @@ -222,8 +222,13 @@ enum class Attribute : u64 { FrontFace = 255, }; +constexpr size_t NUM_TXT_COORD = 10; constexpr size_t NUM_GENERICS = 32; +[[nodiscard]] u32 TxtCoordAttributeIndex(Attribute attribute); + +[[nodiscard]] u32 TxtCoordAttributeElement(Attribute attribute); + [[nodiscard]] bool IsGeneric(Attribute attribute) noexcept; [[nodiscard]] u32 GenericAttributeIndex(Attribute attribute); |