diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-07-23 23:53:25 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-23 23:53:25 -0300 |
| commit | 5a7df48975bcb04b1805031a26f5007211fe4c62 (patch) | |
| tree | 7de88433b0427368d08b13d061c69ebeaf265624 /Ryujinx.Graphics.Gpu/Engine/MME | |
| parent | 3c1f220c5ec6ea824e6a0c12d77fd8ce01ee0d1b (diff) | |
New GPFifo and fast guest constant buffer updates (#1400)
* Add new structures from official docs, start migrating GPFifo
* Finish migration to new GPFifo processor
* Implement fast constant buffer data upload
* Migrate to new GPFifo class
* XML docs
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/MME')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs b/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs new file mode 100644 index 00000000..10127d11 --- /dev/null +++ b/Ryujinx.Graphics.Gpu/Engine/MME/Macro.cs @@ -0,0 +1,69 @@ +using Ryujinx.Graphics.Gpu.State; + +namespace Ryujinx.Graphics.Gpu.Engine.MME +{ + /// <summary> + /// GPU macro program. + /// </summary> + struct Macro + { + /// <summary> + /// Word offset of the code on the code memory. + /// </summary> + public int Position { get; } + + private bool _executionPending; + private int _argument; + + private readonly MacroInterpreter _interpreter; + + /// <summary> + /// Creates a new instance of the GPU cached macro program. + /// </summary> + /// <param name="position">Macro code start position</param> + public Macro(int position) + { + Position = position; + + _executionPending = false; + _argument = 0; + + _interpreter = new MacroInterpreter(); + } + + /// <summary> + /// Sets the first argument for the macro call. + /// </summary> + /// <param name="argument">First argument</param> + public void StartExecution(int argument) + { + _argument = argument; + + _executionPending = true; + } + + /// <summary> + /// Starts executing the macro program code. + /// </summary> + /// <param name="mme">Program code</param> + /// <param name="state">Current GPU state</param> + public void Execute(int[] mme, ShadowRamControl shadowCtrl, GpuState state) + { + if (_executionPending) + { + _executionPending = false; + + _interpreter?.Execute(mme, Position, _argument, shadowCtrl, state); + } + } + + /// <summary> + /// Pushes an argument to the macro call argument FIFO. + /// </summary> + /// <param name="argument">Argument to be pushed</param> + public void PushArgument(int argument) + { + _interpreter?.Fifo.Enqueue(argument); + } + } +} |
