aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Shared.glsl21
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Storage.glsl21
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/HelperFunctionNames.cs22
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighS32.glsl7
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighU32.glsl7
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/Shuffle.glsl11
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleDown.glsl11
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleUp.glsl9
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleXor.glsl11
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreSharedSmallInt.glsl23
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreStorageSmallInt.glsl23
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/SwizzleAdd.glsl7
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl19
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl26
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_vp.glsl20
15 files changed, 0 insertions, 238 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Shared.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Shared.glsl
deleted file mode 100644
index 82b76bcc..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Shared.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-int Helper_AtomicMaxS32(int offset, int value)
-{
- uint oldValue, newValue;
- do
- {
- oldValue = $SHARED_MEM$[offset];
- newValue = uint(max(int(oldValue), value));
- } while (atomicCompSwap($SHARED_MEM$[offset], oldValue, newValue) != oldValue);
- return int(oldValue);
-}
-
-int Helper_AtomicMinS32(int offset, int value)
-{
- uint oldValue, newValue;
- do
- {
- oldValue = $SHARED_MEM$[offset];
- newValue = uint(min(int(oldValue), value));
- } while (atomicCompSwap($SHARED_MEM$[offset], oldValue, newValue) != oldValue);
- return int(oldValue);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Storage.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Storage.glsl
deleted file mode 100644
index 0862a71b..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/AtomicMinMaxS32Storage.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-int Helper_AtomicMaxS32(int index, int offset, int value)
-{
- uint oldValue, newValue;
- do
- {
- oldValue = $STORAGE_MEM$[index].data[offset];
- newValue = uint(max(int(oldValue), value));
- } while (atomicCompSwap($STORAGE_MEM$[index].data[offset], oldValue, newValue) != oldValue);
- return int(oldValue);
-}
-
-int Helper_AtomicMinS32(int index, int offset, int value)
-{
- uint oldValue, newValue;
- do
- {
- oldValue = $STORAGE_MEM$[index].data[offset];
- newValue = uint(min(int(oldValue), value));
- } while (atomicCompSwap($STORAGE_MEM$[index].data[offset], oldValue, newValue) != oldValue);
- return int(oldValue);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/HelperFunctionNames.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/HelperFunctionNames.cs
deleted file mode 100644
index 54f35b15..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/HelperFunctionNames.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
-{
- static class HelperFunctionNames
- {
- public static string AtomicMaxS32 = "Helper_AtomicMaxS32";
- public static string AtomicMinS32 = "Helper_AtomicMinS32";
-
- public static string MultiplyHighS32 = "Helper_MultiplyHighS32";
- public static string MultiplyHighU32 = "Helper_MultiplyHighU32";
-
- public static string Shuffle = "Helper_Shuffle";
- public static string ShuffleDown = "Helper_ShuffleDown";
- public static string ShuffleUp = "Helper_ShuffleUp";
- public static string ShuffleXor = "Helper_ShuffleXor";
- public static string SwizzleAdd = "Helper_SwizzleAdd";
-
- public static string StoreShared16 = "Helper_StoreShared16";
- public static string StoreShared8 = "Helper_StoreShared8";
- public static string StoreStorage16 = "Helper_StoreStorage16";
- public static string StoreStorage8 = "Helper_StoreStorage8";
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighS32.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighS32.glsl
deleted file mode 100644
index caad6f56..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighS32.glsl
+++ /dev/null
@@ -1,7 +0,0 @@
-int Helper_MultiplyHighS32(int x, int y)
-{
- int msb;
- int lsb;
- imulExtended(x, y, msb, lsb);
- return msb;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighU32.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighU32.glsl
deleted file mode 100644
index 617a925f..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighU32.glsl
+++ /dev/null
@@ -1,7 +0,0 @@
-uint Helper_MultiplyHighU32(uint x, uint y)
-{
- uint msb;
- uint lsb;
- umulExtended(x, y, msb, lsb);
- return msb;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/Shuffle.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/Shuffle.glsl
deleted file mode 100644
index 7cb4764d..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/Shuffle.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-float Helper_Shuffle(float x, uint index, uint mask, out bool valid)
-{
- uint clamp = mask & 0x1fu;
- uint segMask = (mask >> 8) & 0x1fu;
- uint minThreadId = $SUBGROUP_INVOCATION$ & segMask;
- uint maxThreadId = minThreadId | (clamp & ~segMask);
- uint srcThreadId = (index & ~segMask) | minThreadId;
- valid = srcThreadId <= maxThreadId;
- float v = $SUBGROUP_BROADCAST$(x, srcThreadId);
- return valid ? v : x;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleDown.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleDown.glsl
deleted file mode 100644
index 71d901d5..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleDown.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-float Helper_ShuffleDown(float x, uint index, uint mask, out bool valid)
-{
- uint clamp = mask & 0x1fu;
- uint segMask = (mask >> 8) & 0x1fu;
- uint minThreadId = $SUBGROUP_INVOCATION$ & segMask;
- uint maxThreadId = minThreadId | (clamp & ~segMask);
- uint srcThreadId = $SUBGROUP_INVOCATION$ + index;
- valid = srcThreadId <= maxThreadId;
- float v = $SUBGROUP_BROADCAST$(x, srcThreadId);
- return valid ? v : x;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleUp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleUp.glsl
deleted file mode 100644
index ae264d87..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleUp.glsl
+++ /dev/null
@@ -1,9 +0,0 @@
-float Helper_ShuffleUp(float x, uint index, uint mask, out bool valid)
-{
- uint segMask = (mask >> 8) & 0x1fu;
- uint minThreadId = $SUBGROUP_INVOCATION$ & segMask;
- uint srcThreadId = $SUBGROUP_INVOCATION$ - index;
- valid = int(srcThreadId) >= int(minThreadId);
- float v = $SUBGROUP_BROADCAST$(x, srcThreadId);
- return valid ? v : x;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleXor.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleXor.glsl
deleted file mode 100644
index 789089d6..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/ShuffleXor.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-float Helper_ShuffleXor(float x, uint index, uint mask, out bool valid)
-{
- uint clamp = mask & 0x1fu;
- uint segMask = (mask >> 8) & 0x1fu;
- uint minThreadId = $SUBGROUP_INVOCATION$ & segMask;
- uint maxThreadId = minThreadId | (clamp & ~segMask);
- uint srcThreadId = $SUBGROUP_INVOCATION$ ^ index;
- valid = srcThreadId <= maxThreadId;
- float v = $SUBGROUP_BROADCAST$(x, srcThreadId);
- return valid ? v : x;
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreSharedSmallInt.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreSharedSmallInt.glsl
deleted file mode 100644
index 2f57b5ff..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreSharedSmallInt.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-void Helper_StoreShared16(int offset, uint value)
-{
- int wordOffset = offset >> 2;
- int bitOffset = (offset & 3) * 8;
- uint oldValue, newValue;
- do
- {
- oldValue = $SHARED_MEM$[wordOffset];
- newValue = bitfieldInsert(oldValue, value, bitOffset, 16);
- } while (atomicCompSwap($SHARED_MEM$[wordOffset], oldValue, newValue) != oldValue);
-}
-
-void Helper_StoreShared8(int offset, uint value)
-{
- int wordOffset = offset >> 2;
- int bitOffset = (offset & 3) * 8;
- uint oldValue, newValue;
- do
- {
- oldValue = $SHARED_MEM$[wordOffset];
- newValue = bitfieldInsert(oldValue, value, bitOffset, 8);
- } while (atomicCompSwap($SHARED_MEM$[wordOffset], oldValue, newValue) != oldValue);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreStorageSmallInt.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreStorageSmallInt.glsl
deleted file mode 100644
index f2253a79..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/StoreStorageSmallInt.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-void Helper_StoreStorage16(int index, int offset, uint value)
-{
- int wordOffset = offset >> 2;
- int bitOffset = (offset & 3) * 8;
- uint oldValue, newValue;
- do
- {
- oldValue = $STORAGE_MEM$[index].data[wordOffset];
- newValue = bitfieldInsert(oldValue, value, bitOffset, 16);
- } while (atomicCompSwap($STORAGE_MEM$[index].data[wordOffset], oldValue, newValue) != oldValue);
-}
-
-void Helper_StoreStorage8(int index, int offset, uint value)
-{
- int wordOffset = offset >> 2;
- int bitOffset = (offset & 3) * 8;
- uint oldValue, newValue;
- do
- {
- oldValue = $STORAGE_MEM$[index].data[wordOffset];
- newValue = bitfieldInsert(oldValue, value, bitOffset, 8);
- } while (atomicCompSwap($STORAGE_MEM$[index].data[wordOffset], oldValue, newValue) != oldValue);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/SwizzleAdd.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/SwizzleAdd.glsl
deleted file mode 100644
index 057cb6ca..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/SwizzleAdd.glsl
+++ /dev/null
@@ -1,7 +0,0 @@
-float Helper_SwizzleAdd(float x, float y, int mask)
-{
- vec4 xLut = vec4(1.0, -1.0, 1.0, 0.0);
- vec4 yLut = vec4(1.0, 1.0, -1.0, 1.0);
- int lutIdx = (mask >> (int($SUBGROUP_INVOCATION$ & 3u) * 2)) & 3;
- return x * xLut[lutIdx] + y * yLut[lutIdx];
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl
deleted file mode 100644
index 4ebade5e..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-ivec2 Helper_TexelFetchScale(ivec2 inputVec, int samplerIndex)
-{
- float scale = s_render_scale[samplerIndex];
- if (scale == 1.0)
- {
- return inputVec;
- }
- return ivec2(vec2(inputVec) * scale);
-}
-
-int Helper_TextureSizeUnscale(int size, int samplerIndex)
-{
- float scale = s_render_scale[samplerIndex];
- if (scale == 1.0)
- {
- return size;
- }
- return int(float(size) / scale);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl
deleted file mode 100644
index 6c670f91..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl
+++ /dev/null
@@ -1,26 +0,0 @@
-ivec2 Helper_TexelFetchScale(ivec2 inputVec, int samplerIndex)
-{
- float scale = s_render_scale[1 + samplerIndex];
- if (scale == 1.0)
- {
- return inputVec;
- }
- if (scale < 0.0) // If less than 0, try interpolate between texels by using the screen position.
- {
- return ivec2(vec2(inputVec) * (-scale) + mod(gl_FragCoord.xy, 0.0 - scale));
- }
- else
- {
- return ivec2(vec2(inputVec) * scale);
- }
-}
-
-int Helper_TextureSizeUnscale(int size, int samplerIndex)
-{
- float scale = abs(s_render_scale[1 + samplerIndex]);
- if (scale == 1.0)
- {
- return size;
- }
- return int(float(size) / scale);
-} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_vp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_vp.glsl
deleted file mode 100644
index 19eb119d..00000000
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_vp.glsl
+++ /dev/null
@@ -1,20 +0,0 @@
-ivec2 Helper_TexelFetchScale(ivec2 inputVec, int samplerIndex)
-{
- float scale = abs(s_render_scale[1 + samplerIndex + s_frag_scale_count]);
- if (scale == 1.0)
- {
- return inputVec;
- }
-
- return ivec2(vec2(inputVec) * scale);
-}
-
-int Helper_TextureSizeUnscale(int size, int samplerIndex)
-{
- float scale = abs(s_render_scale[1 + samplerIndex + s_frag_scale_count]);
- if (scale == 1.0)
- {
- return size;
- }
- return int(float(size) / scale);
-} \ No newline at end of file