Remove TranslatorConfig struct
This commit is contained in:
parent
6a8ba6d600
commit
3ca675223a
7 changed files with 14 additions and 48 deletions
|
@ -3,5 +3,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen
|
|||
static class Constants
|
||||
{
|
||||
public const int MaxShaderStorageBuffers = 16;
|
||||
|
||||
public const int ConstantBufferSize = 0x10000; // In bytes
|
||||
}
|
||||
}
|
|
@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
|||
|
||||
context.EnterScope();
|
||||
|
||||
string ubSize = "[" + NumberFormatter.FormatInt(context.Config.MaxCBufferSize / 16) + "]";
|
||||
string ubSize = "[" + NumberFormatter.FormatInt(Constants.ConstantBufferSize / 16) + "]";
|
||||
|
||||
context.AppendLine("vec4 " + OperandManager.GetUbName(context.Config.Stage, cbufSlot) + ubSize + ";");
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace Ryujinx.Graphics.Shader
|
|||
|
||||
public TranslationFlags Flags { get; }
|
||||
|
||||
public int MaxCBufferSize { get; }
|
||||
public int MaxOutputVertices { get; }
|
||||
|
||||
public OutputTopology OutputTopology { get; }
|
||||
|
@ -16,13 +15,11 @@ namespace Ryujinx.Graphics.Shader
|
|||
public ShaderConfig(
|
||||
ShaderStage stage,
|
||||
TranslationFlags flags,
|
||||
int maxCBufferSize,
|
||||
int maxOutputVertices,
|
||||
OutputTopology outputTopology)
|
||||
{
|
||||
Stage = stage;
|
||||
Flags = flags;
|
||||
MaxCBufferSize = maxCBufferSize;
|
||||
MaxOutputVertices = maxOutputVertices;
|
||||
OutputTopology = outputTopology;
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.Translation
|
||||
{
|
||||
public struct TranslationConfig
|
||||
{
|
||||
public int MaxCBufferSize { get; }
|
||||
|
||||
public int Version { get; }
|
||||
|
||||
public TranslationFlags Flags { get; }
|
||||
|
||||
public TranslationConfig(int maxCBufferSize, int version, TranslationFlags flags)
|
||||
{
|
||||
if (maxCBufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(maxCBufferSize));
|
||||
}
|
||||
|
||||
MaxCBufferSize = maxCBufferSize;
|
||||
Version = version;
|
||||
Flags = flags;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,10 +48,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
return code.Slice(0, headerSize + (int)endAddress);
|
||||
}
|
||||
|
||||
public static ShaderProgram Translate(Span<byte> code, TranslationConfig translationConfig)
|
||||
public static ShaderProgram Translate(Span<byte> code, TranslationFlags flags)
|
||||
{
|
||||
bool compute = (translationConfig.Flags & TranslationFlags.Compute) != 0;
|
||||
bool debugMode = (translationConfig.Flags & TranslationFlags.DebugMode) != 0;
|
||||
bool compute = (flags & TranslationFlags.Compute) != 0;
|
||||
bool debugMode = (flags & TranslationFlags.DebugMode) != 0;
|
||||
|
||||
Operation[] ops = DecodeShader(
|
||||
code,
|
||||
|
@ -83,25 +83,23 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
|
||||
ShaderConfig config = new ShaderConfig(
|
||||
stage,
|
||||
translationConfig.Flags,
|
||||
translationConfig.MaxCBufferSize,
|
||||
flags,
|
||||
maxOutputVertexCount,
|
||||
outputTopology);
|
||||
|
||||
return Translate(ops, config, size);
|
||||
}
|
||||
|
||||
public static ShaderProgram Translate(Span<byte> vpACode, Span<byte> vpBCode, TranslationConfig translationConfig)
|
||||
public static ShaderProgram Translate(Span<byte> vpACode, Span<byte> vpBCode, TranslationFlags flags)
|
||||
{
|
||||
bool debugMode = (translationConfig.Flags & TranslationFlags.DebugMode) != 0;
|
||||
bool debugMode = (flags & TranslationFlags.DebugMode) != 0;
|
||||
|
||||
Operation[] vpAOps = DecodeShader(vpACode, compute: false, debugMode, out _, out _);
|
||||
Operation[] vpBOps = DecodeShader(vpBCode, compute: false, debugMode, out ShaderHeader header, out int sizeB);
|
||||
|
||||
ShaderConfig config = new ShaderConfig(
|
||||
header.Stage,
|
||||
translationConfig.Flags,
|
||||
translationConfig.MaxCBufferSize,
|
||||
flags,
|
||||
header.MaxOutputVertexCount,
|
||||
header.OutputTopology);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue