aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/AttributeType.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/AttributeType.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/AttributeType.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/AttributeType.cs b/src/Ryujinx.Graphics.Shader/AttributeType.cs
index e6adb4b8..1d950773 100644
--- a/src/Ryujinx.Graphics.Shader/AttributeType.cs
+++ b/src/Ryujinx.Graphics.Shader/AttributeType.cs
@@ -9,6 +9,8 @@ namespace Ryujinx.Graphics.Shader
Float,
Sint,
Uint,
+ Sscaled,
+ Uscaled,
}
static class AttributeTypeExtensions
@@ -23,5 +25,18 @@ namespace Ryujinx.Graphics.Shader
_ => throw new ArgumentException($"Invalid attribute type \"{type}\"."),
};
}
+
+ public static AggregateType ToAggregateType(this AttributeType type, bool supportsScaledFormats)
+ {
+ return type switch
+ {
+ AttributeType.Float => AggregateType.FP32,
+ AttributeType.Sint => AggregateType.S32,
+ AttributeType.Uint => AggregateType.U32,
+ AttributeType.Sscaled => supportsScaledFormats ? AggregateType.FP32 : AggregateType.S32,
+ AttributeType.Uscaled => supportsScaledFormats ? AggregateType.FP32 : AggregateType.U32,
+ _ => throw new ArgumentException($"Invalid attribute type \"{type}\"."),
+ };
+ }
}
}