aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Texture/Astc/EndPointSet.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2019-12-26 23:09:49 -0700
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commitd1ab9fb42c2fd9f018d4410ca619cd66294eafc9 (patch)
treedcac71560b921f29d73ee6e21f235528184d9f84 /Ryujinx.Graphics.Texture/Astc/EndPointSet.cs
parent947e14d3be0f7c5e4b6f77df204ec675b8e9e719 (diff)
ASTC optimizations (#845)
* ASTC optimizations * Move code to Ryujinx.Common * Support 3D textures * Address feedback * Remove ASTC logging * Use stackalloc instead of a Buffer20 struct * Code style and cleanup * Respond to feedback * Rearrange public/private property ordering
Diffstat (limited to 'Ryujinx.Graphics.Texture/Astc/EndPointSet.cs')
-rw-r--r--Ryujinx.Graphics.Texture/Astc/EndPointSet.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Texture/Astc/EndPointSet.cs b/Ryujinx.Graphics.Texture/Astc/EndPointSet.cs
new file mode 100644
index 00000000..45e61ca2
--- /dev/null
+++ b/Ryujinx.Graphics.Texture/Astc/EndPointSet.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Graphics.Texture.Astc
+{
+ [StructLayout(LayoutKind.Sequential, Size = AstcPixel.StructSize * 8)]
+ internal struct EndPointSet
+ {
+ private AstcPixel _start;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span<AstcPixel> Get(int index)
+ {
+ Debug.Assert(index < 4);
+
+ ref AstcPixel start = ref Unsafe.Add(ref _start, index * 2);
+
+ return MemoryMarshal.CreateSpan(ref start, 2);
+ }
+ }
+}