aboutsummaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/attribute.cpp
diff options
context:
space:
mode:
authorFeng Chen <vonchenplus@gmail.com>2021-09-03 23:52:20 +0800
committerFeng Chen <vonchenplus@gmail.com>2021-09-03 23:52:20 +0800
commita7bbaa489755c9847416c8c96f0eefb9e78a50a0 (patch)
tree341ab621a49becca148157877d6e57e2a31ba770 /src/shader_recompiler/frontend/ir/attribute.cpp
parentcf26f375ff2bfc84445270cf1077504ab4cc41f6 (diff)
Rename parameters
Diffstat (limited to 'src/shader_recompiler/frontend/ir/attribute.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/attribute.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp
index dc2bec06db..5b3694f652 100644
--- a/src/shader_recompiler/frontend/ir/attribute.cpp
+++ b/src/shader_recompiler/frontend/ir/attribute.cpp
@@ -9,11 +9,21 @@
namespace Shader::IR {
-u32 TxtCoordAttributeIndex(Attribute attribute) {
+bool IsFixedFncTexture(Attribute attribute) {
+ return attribute >= Attribute::FixedFncTexture0S && attribute <= Attribute::FixedFncTexture9Q;
+}
+
+u32 FixedFncTextureAttributeIndex(Attribute attribute) {
+ if (!IsFixedFncTexture(attribute)) {
+ throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute);
+ }
return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::FixedFncTexture0S)) / 4u;
}
-u32 TxtCoordAttributeElement(Attribute attribute) {
+u32 FixedFncTextureAttributeElement(Attribute attribute) {
+ if (!IsFixedFncTexture(attribute)) {
+ throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute);
+ }
return static_cast<u32>(attribute) % 4;
}