From 402f05b8ef013807997589ecc0a8ff50267dcd23 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 20 May 2023 16:19:26 -0300 Subject: Replace constant buffer access on shader with new Load instruction (#4646) --- src/Ryujinx.Graphics.Shader/SupportBuffer.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/Ryujinx.Graphics.Shader/SupportBuffer.cs') diff --git a/src/Ryujinx.Graphics.Shader/SupportBuffer.cs b/src/Ryujinx.Graphics.Shader/SupportBuffer.cs index 5fe99327..5eb7fe46 100644 --- a/src/Ryujinx.Graphics.Shader/SupportBuffer.cs +++ b/src/Ryujinx.Graphics.Shader/SupportBuffer.cs @@ -1,4 +1,6 @@ using Ryujinx.Common.Memory; +using Ryujinx.Graphics.Shader.StructuredIr; +using Ryujinx.Graphics.Shader.Translation; using System.Runtime.CompilerServices; namespace Ryujinx.Graphics.Shader @@ -11,8 +13,20 @@ namespace Ryujinx.Graphics.Shader public T W; } + enum SupportBufferField + { + // Must match the order of the fields on the struct. + FragmentAlphaTest, + FragmentIsBgra, + ViewportInverse, + FragmentRenderScaleCount, + RenderScale + } + public struct SupportBuffer { + internal const int Binding = 0; + public static int FieldSize; public static int RequiredSize; @@ -47,6 +61,18 @@ namespace Ryujinx.Graphics.Shader ComputeRenderScaleOffset = GraphicsRenderScaleOffset + FieldSize; } + internal static StructureType GetStructureType() + { + return new StructureType(new[] + { + new StructureField(AggregateType.U32, "s_alpha_test"), + new StructureField(AggregateType.Array | AggregateType.U32, "s_is_bgra", FragmentIsBgraCount), + new StructureField(AggregateType.Vector4 | AggregateType.FP32, "s_viewport_inverse"), + new StructureField(AggregateType.S32, "s_frag_scale_count"), + new StructureField(AggregateType.Array | AggregateType.FP32, "s_render_scale", RenderScaleMaxCount) + }); + } + public Vector4 FragmentAlphaTest; public Array8> FragmentIsBgra; public Vector4 ViewportInverse; -- cgit v1.2.3