aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/QuadHelper.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-13 03:02:07 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1876b346fea647e8284a66bb6d62c38801035cff (patch)
tree6eeff094298cda84d1613dc5ec0691e51d7b35f1 /Ryujinx.Graphics/QuadHelper.cs
parentf617fb542a0e3d36012d77a4b5acbde7b08902f2 (diff)
Initial work
Diffstat (limited to 'Ryujinx.Graphics/QuadHelper.cs')
-rw-r--r--Ryujinx.Graphics/QuadHelper.cs81
1 files changed, 0 insertions, 81 deletions
diff --git a/Ryujinx.Graphics/QuadHelper.cs b/Ryujinx.Graphics/QuadHelper.cs
deleted file mode 100644
index 643084ba..00000000
--- a/Ryujinx.Graphics/QuadHelper.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-
-namespace Ryujinx.Graphics
-{
- static class QuadHelper
- {
- public static int ConvertSizeQuadsToTris(int size)
- {
- return size <= 0 ? 0 : (size / 4) * 6;
- }
-
- public static int ConvertSizeQuadStripToTris(int size)
- {
- return size <= 1 ? 0 : ((size - 2) / 2) * 6;
- }
-
- public static byte[] ConvertQuadsToTris(byte[] data, int entrySize, int count)
- {
- int primitivesCount = count / 4;
-
- int quadPrimSize = 4 * entrySize;
- int trisPrimSize = 6 * entrySize;
-
- byte[] output = new byte[primitivesCount * 6 * entrySize];
-
- for (int prim = 0; prim < primitivesCount; prim++)
- {
- void AssignIndex(int src, int dst, int copyCount = 1)
- {
- src = prim * quadPrimSize + src * entrySize;
- dst = prim * trisPrimSize + dst * entrySize;
-
- Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize);
- }
-
- // 0 1 2 -> 0 1 2.
- AssignIndex(0, 0, 3);
-
- // 2 3 -> 3 4.
- AssignIndex(2, 3, 2);
-
- // 0 -> 5.
- AssignIndex(0, 5);
- }
-
- return output;
- }
-
- public static byte[] ConvertQuadStripToTris(byte[] data, int entrySize, int count)
- {
- int primitivesCount = (count - 2) / 2;
-
- int quadPrimSize = 2 * entrySize;
- int trisPrimSize = 6 * entrySize;
-
- byte[] output = new byte[primitivesCount * 6 * entrySize];
-
- for (int prim = 0; prim < primitivesCount; prim++)
- {
- void AssignIndex(int src, int dst, int copyCount = 1)
- {
- src = prim * quadPrimSize + src * entrySize + 2 * entrySize;
- dst = prim * trisPrimSize + dst * entrySize;
-
- Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize);
- }
-
- // -2 -1 0 -> 0 1 2.
- AssignIndex(-2, 0, 3);
-
- // 0 1 -> 3 4.
- AssignIndex(0, 3, 2);
-
- // -2 -> 5.
- AssignIndex(-2, 5);
- }
-
- return output;
- }
- }
-} \ No newline at end of file