From effd546331371928bc38bc8a48b0c26c7c59f3e9 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 16 Aug 2023 08:30:33 -0300 Subject: Implement scaled vertex format emulation (#5564) * Implement scaled vertex format emulation * Auto-format (whitespace) * Delete ToVec4Type --- src/Ryujinx.Graphics.Shader/AttributeType.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Ryujinx.Graphics.Shader/AttributeType.cs') 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}\"."), + }; + } } } -- cgit v1.2.3