diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-30 23:53:09 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 6a98c643cabeea25dc42e19fe475a687a034a532 (patch) | |
| tree | ccb1ecbfc5b79852be8a1f52e241015142a8a7a9 /Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | |
| parent | 396768f3b4494c7dcb0c03942eeb50ef4d47adde (diff) | |
Add a pass to turn global memory access into storage access, and do all storage related transformations on IR
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index e8b44961..a5c8cc9a 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl if (info.SBuffers.Count != 0) { - DeclareUsedStorage(context, info); + DeclareStorages(context, info); context.AppendLine(); } @@ -176,11 +176,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl context.AppendLine(GetVarTypeName(decl.VarType) + " " + name + ";"); } - - if ((info.HelperFunctionsMask & HelperFunctionsMask.GlobalMemory) != 0) - { - context.AppendLine($"ivec2 {DefaultNames.GmemOffsetName};"); - } } private static string GetVarTypeName(VariableType type) @@ -218,31 +213,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl } } - private static void DeclareAllStorage(CodeGenContext context, StructuredProgramInfo info) - { - string sbName = OperandManager.GetShaderStagePrefix(context.Config.Stage); - - sbName += "_" + DefaultNames.StorageNamePrefix; - - string blockName = $"{sbName}_{DefaultNames.BlockSuffix}"; - - context.AppendLine("layout (std430) buffer " + blockName); - - context.EnterScope(); - - context.AppendLine("uint " + DefaultNames.DataName + "[];"); - - string arraySize = NumberFormatter.FormatInt(Constants.MaxShaderStorageBuffers); - - context.LeaveScope($" {sbName}[{arraySize}];"); - - for (int sbufSlot = 0; sbufSlot < Constants.MaxShaderStorageBuffers; sbufSlot++) - { - context.SBufferDescriptors.Add(new BufferDescriptor($"{blockName}[{sbufSlot}]", sbufSlot)); - } - } - - private static void DeclareUsedStorage(CodeGenContext context, StructuredProgramInfo info) + private static void DeclareStorages(CodeGenContext context, StructuredProgramInfo info) { string sbName = OperandManager.GetShaderStagePrefix(context.Config.Stage); |
