Move MaxUboSize definition

This fix a crash on Ryujinx.ShaderTools caused by the absence of an
OpenGL context.
This commit is contained in:
Thog 2018-12-07 01:01:41 +01:00
parent fb1d9493a3
commit 17c31c06b7
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
4 changed files with 8 additions and 7 deletions

View file

@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
GlslProgram Program;
GlslDecompiler Decompiler = new GlslDecompiler();
GlslDecompiler Decompiler = new GlslDecompiler(OGLLimit.MaxUboSize);
int ShaderDumpIndex = ShaderDumper.DumpIndex;

View file

@ -1,4 +1,3 @@
using Ryujinx.Graphics.Gal.OpenGL;
using System;
using System.Collections.Generic;
@ -50,8 +49,6 @@ namespace Ryujinx.Graphics.Gal.Shader
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;

View file

@ -31,7 +31,9 @@ namespace Ryujinx.Graphics.Gal.Shader
private StringBuilder SB;
public GlslDecompiler()
public static int MaxUboSize { get; private set; }
public GlslDecompiler(int MaxUboSize)
{
InstsExpr = new Dictionary<ShaderIrInst, GetInstExpr>()
{
@ -106,6 +108,8 @@ namespace Ryujinx.Graphics.Gal.Shader
{ ShaderIrInst.Utof, GetUtofExpr },
{ ShaderIrInst.Xor, GetXorExpr }
};
GlslDecompiler.MaxUboSize = MaxUboSize / 16;
}
public GlslProgram Decompile(
@ -259,7 +263,7 @@ namespace Ryujinx.Graphics.Gal.Shader
{
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("};");
}

View file

@ -11,7 +11,7 @@ namespace Ryujinx.ShaderTools
{
if (args.Length == 2)
{
GlslDecompiler Decompiler = new GlslDecompiler();
GlslDecompiler Decompiler = new GlslDecompiler(65536);
GalShaderType ShaderType = GalShaderType.Vertex;