Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move MaxUboSize definition #530

Merged
merged 3 commits into from Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Ryujinx.Graphics/Gal/OpenGL/OGLShader.cs
Expand Up @@ -53,7 +53,7 @@ public void Create(IGalMemory Memory, long VpAPos, long Key, GalShaderType Type)
{
GlslProgram Program;

GlslDecompiler Decompiler = new GlslDecompiler();
GlslDecompiler Decompiler = new GlslDecompiler(OGLLimit.MaxUboSize);

int ShaderDumpIndex = ShaderDumper.DumpIndex;

Expand Down
3 changes: 0 additions & 3 deletions Ryujinx.Graphics/Gal/Shader/GlslDecl.cs
@@ -1,4 +1,3 @@
using Ryujinx.Graphics.Gal.OpenGL;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -50,8 +49,6 @@ class GlslDecl
public const string SsyStackName = "ssy_stack";
public const string SsyCursorName = "ssy_cursor";

public static int MaxUboSize => OGLLimit.MaxUboSize / 16;

private string[] StagePrefixes = new string[] { "vp", "tcp", "tep", "gp", "fp" };

private string StagePrefix;
Expand Down
8 changes: 6 additions & 2 deletions Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs
Expand Up @@ -31,7 +31,9 @@ private enum OperType

private StringBuilder SB;

public GlslDecompiler()
public int MaxUboSize { get; }

public GlslDecompiler(int MaxUboSize)
{
InstsExpr = new Dictionary<ShaderIrInst, GetInstExpr>()
{
Expand Down Expand Up @@ -106,6 +108,8 @@ public GlslDecompiler()
{ ShaderIrInst.Utof, GetUtofExpr },
{ ShaderIrInst.Xor, GetXorExpr }
};

this.MaxUboSize = MaxUboSize / 16;
}

public GlslProgram Decompile(
Expand Down Expand Up @@ -259,7 +263,7 @@ private void PrintDeclUniforms()
{
SB.AppendLine($"layout (std140) uniform {DeclInfo.Name} {{");

SB.AppendLine($"{IdentationStr}vec4 {DeclInfo.Name}_data[{GlslDecl.MaxUboSize}];");
SB.AppendLine($"{IdentationStr}vec4 {DeclInfo.Name}_data[{MaxUboSize}];");

SB.AppendLine("};");
}
Expand Down
4 changes: 3 additions & 1 deletion Ryujinx.ShaderTools/Program.cs
Expand Up @@ -7,11 +7,13 @@ namespace Ryujinx.ShaderTools
{
class Program
{
private static readonly int MaxUboSize = 65536;

static void Main(string[] args)
{
if (args.Length == 2)
{
GlslDecompiler Decompiler = new GlslDecompiler();
GlslDecompiler Decompiler = new GlslDecompiler(MaxUboSize);

GalShaderType ShaderType = GalShaderType.Vertex;

Expand Down