diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-12-16 01:59:46 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 9d7a142a48a5f804127fcae2265bb6ec5495d178 (patch) | |
| tree | 4ba4de906d74404760fcbebe9aeb51460252f500 /Ryujinx.Graphics.Shader/CodeGen | |
| parent | 2eccc7023ae0d1247378516b14507d422e4915c5 (diff) | |
Support texture rectangle targets (non-normalized coords)
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index b96aa1ae..bad5c00c 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -35,23 +35,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl if (context.Config.Stage == ShaderStage.Geometry) { - string inPrimitive = "points"; - - if ((context.Config.Flags & TranslationFlags.Unspecialized) != 0) - { - inPrimitive = DefineNames.InputTopologyName; - } + string inPrimitive = ((InputTopology)context.Config.QueryInfo(QueryInfoName.PrimitiveTopology)).ToGlslString(); context.AppendLine($"layout ({inPrimitive}) in;"); - string outPrimitive = "triangle_strip"; - - switch (context.Config.OutputTopology) - { - case OutputTopology.LineStrip: outPrimitive = "line_strip"; break; - case OutputTopology.PointList: outPrimitive = "points"; break; - case OutputTopology.TriangleStrip: outPrimitive = "triangle_strip"; break; - } + string outPrimitive = context.Config.OutputTopology.ToGlslString(); int maxOutputVertices = context.Config.MaxOutputVertices; @@ -75,16 +63,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl if (context.Config.Stage == ShaderStage.Compute) { - string size; - - if ((context.Config.Flags & TranslationFlags.Unspecialized) != 0) - { - size = DefineNames.SharedMemorySize; - } - else - { - size = NumberFormatter.FormatInt(context.Config.Capabilities.MaximumComputeSharedMemorySize / 4); - } + string size = NumberFormatter.FormatInt(BitUtils.DivRoundUp(context.Config.QueryInfo(QueryInfoName.ComputeSharedMemorySize), 4)); context.AppendLine($"shared uint {DefaultNames.SharedMemoryName}[{size}];"); context.AppendLine(); @@ -136,19 +115,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl } else { - string localSizeX = "1"; - string localSizeY = "1"; - string localSizeZ = "1"; - - if ((context.Config.Flags & TranslationFlags.Unspecialized) != 0) - { - localSizeX = DefineNames.LocalSizeX; - localSizeY = DefineNames.LocalSizeY; - localSizeZ = DefineNames.LocalSizeZ; - } + string localSizeX = NumberFormatter.FormatInt(context.Config.QueryInfo(QueryInfoName.ComputeLocalSizeX)); + string localSizeY = NumberFormatter.FormatInt(context.Config.QueryInfo(QueryInfoName.ComputeLocalSizeY)); + string localSizeZ = NumberFormatter.FormatInt(context.Config.QueryInfo(QueryInfoName.ComputeLocalSizeZ)); context.AppendLine( - $"layout (" + + "layout (" + $"local_size_x = {localSizeX}, " + $"local_size_y = {localSizeY}, " + $"local_size_z = {localSizeZ}) in;"); |
