diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2023-05-20 16:19:26 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-20 16:19:26 -0300 |
| commit | 402f05b8ef013807997589ecc0a8ff50267dcd23 (patch) | |
| tree | 8e3b06c2ce3e3ccd4b443a4c68365251acc668fa /src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs | |
| parent | fb27042e01b0fa110184673d436ec96ec8cf20c7 (diff) | |
Replace constant buffer access on shader with new Load instruction (#4646)
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs index 24993e00..b1b40f65 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs @@ -22,4 +22,35 @@ Array = 1 << 10 } + + static class AggregateTypeExtensions + { + public static int GetSizeInBytes(this AggregateType type) + { + int elementSize = (type & AggregateType.ElementTypeMask) switch + { + AggregateType.Bool or + AggregateType.FP32 or + AggregateType.S32 or + AggregateType.U32 => 4, + AggregateType.FP64 => 8, + _ => 0 + }; + + switch (type & AggregateType.ElementCountMask) + { + case AggregateType.Vector2: + elementSize *= 2; + break; + case AggregateType.Vector3: + elementSize *= 3; + break; + case AggregateType.Vector4: + elementSize *= 4; + break; + } + + return elementSize; + } + } } |
