From 49f970d5bd9163e2b4e26a33ef8f84529174d5de Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 25 Oct 2020 17:00:44 -0300 Subject: Implement CAL and RET shader instructions (#1618) * Add support for CAL and RET shader instructions * Remove unused stuff * Fix a bug that could cause the wrong values to be passed to a function * Avoid repopulating function id dictionary every time * PR feedback * Fix vertex shader A/B merge --- Ryujinx.Graphics.Shader/Translation/EmitterContext.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Ryujinx.Graphics.Shader/Translation/EmitterContext.cs') diff --git a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index c5ebe9e7..d5d30f12 100644 --- a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -13,16 +13,18 @@ namespace Ryujinx.Graphics.Shader.Translation public ShaderConfig Config { get; } - private List _operations; + public bool IsNonMain { get; } - private Dictionary _labels; + private readonly IReadOnlyDictionary _funcs; + private readonly List _operations; + private readonly Dictionary _labels; - public EmitterContext(ShaderConfig config) + public EmitterContext(ShaderConfig config, bool isNonMain, IReadOnlyDictionary funcs) { Config = config; - + IsNonMain = isNonMain; + _funcs = funcs; _operations = new List(); - _labels = new Dictionary(); } @@ -71,6 +73,11 @@ namespace Ryujinx.Graphics.Shader.Translation return label; } + public int GetFunctionId(ulong address) + { + return _funcs[address]; + } + public void PrepareForReturn() { if (Config.Stage == ShaderStage.Fragment) -- cgit v1.2.3