diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.Graphics.Shader/SupportBuffer.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/SupportBuffer.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Shader/SupportBuffer.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/SupportBuffer.cs b/src/Ryujinx.Graphics.Shader/SupportBuffer.cs new file mode 100644 index 00000000..5fe99327 --- /dev/null +++ b/src/Ryujinx.Graphics.Shader/SupportBuffer.cs @@ -0,0 +1,58 @@ +using Ryujinx.Common.Memory; +using System.Runtime.CompilerServices; + +namespace Ryujinx.Graphics.Shader +{ + public struct Vector4<T> + { + public T X; + public T Y; + public T Z; + public T W; + } + + public struct SupportBuffer + { + public static int FieldSize; + public static int RequiredSize; + + public static int FragmentAlphaTestOffset; + public static int FragmentIsBgraOffset; + public static int ViewportInverseOffset; + public static int FragmentRenderScaleCountOffset; + public static int GraphicsRenderScaleOffset; + public static int ComputeRenderScaleOffset; + + public const int FragmentIsBgraCount = 8; + // One for the render target, 64 for the textures, and 8 for the images. + public const int RenderScaleMaxCount = 1 + 64 + 8; + + private static int OffsetOf<T>(ref SupportBuffer storage, ref T target) + { + return (int)Unsafe.ByteOffset(ref Unsafe.As<SupportBuffer, T>(ref storage), ref target); + } + + static SupportBuffer() + { + FieldSize = Unsafe.SizeOf<Vector4<float>>(); + RequiredSize = Unsafe.SizeOf<SupportBuffer>(); + + SupportBuffer instance = new SupportBuffer(); + + FragmentAlphaTestOffset = OffsetOf(ref instance, ref instance.FragmentAlphaTest); + FragmentIsBgraOffset = OffsetOf(ref instance, ref instance.FragmentIsBgra); + ViewportInverseOffset = OffsetOf(ref instance, ref instance.ViewportInverse); + FragmentRenderScaleCountOffset = OffsetOf(ref instance, ref instance.FragmentRenderScaleCount); + GraphicsRenderScaleOffset = OffsetOf(ref instance, ref instance.RenderScale); + ComputeRenderScaleOffset = GraphicsRenderScaleOffset + FieldSize; + } + + public Vector4<int> FragmentAlphaTest; + public Array8<Vector4<int>> FragmentIsBgra; + public Vector4<float> ViewportInverse; + public Vector4<int> FragmentRenderScaleCount; + + // Render scale max count: 1 + 64 + 8. First scale is fragment output scale, others are textures/image inputs. + public Array73<Vector4<float>> RenderScale; + } +}
\ No newline at end of file |
