diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-08-02 22:36:57 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-03 03:36:57 +0200 |
| commit | 60db4c353099e8656a330ede03fdbe57a421fa47 (patch) | |
| tree | 0b04b6fff7c892b7ae9f1d417293d4f81b27a60a /Ryujinx.Graphics.Gpu/Engine/GPFifo | |
| parent | c11855565e0ce2bac228610cbaa92c8c7f082c70 (diff) | |
Implement a Macro JIT (#1445)
* Implement a Macro JIT
* Nit: space
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/GPFifo')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs | 17 |
2 files changed, 23 insertions, 14 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs index 958253ec..0e87aa3d 100644 --- a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs +++ b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClass.cs @@ -13,6 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo class GPFifoClass : IDeviceState { private readonly GpuContext _context; + private readonly GPFifoProcessor _parent; private readonly DeviceState<GPFifoClassState> _state; private const int MacrosCount = 0x80; @@ -25,17 +26,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo private readonly int[] _macroCode; /// <summary> - /// MME Shadow RAM Control. - /// </summary> - public ShadowRamControl ShadowCtrl { get; private set; } - - /// <summary> /// Creates a new instance of the GPU General Purpose FIFO class. /// </summary> /// <param name="context">GPU context</param> - public GPFifoClass(GpuContext context) + /// <param name="parent">Parent GPU General Purpose FIFO processor</param> + public GPFifoClass(GpuContext context, GPFifoProcessor parent) { _context = context; + _parent = parent; _state = new DeviceState<GPFifoClassState>(new Dictionary<string, RwCallback> { { nameof(GPFifoClassState.Semaphored), new RwCallback(Semaphored, null) }, @@ -155,7 +153,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo } /// <summary> - /// Send macro code/data to the MME + /// Sends macro code/data to the MME. /// </summary> /// <param name="argument">Method call argument</param> public void LoadMmeInstructionRam(int argument) @@ -164,7 +162,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo } /// <summary> - /// Bind a macro index to a position for the MME + /// Binds a macro index to a position for the MME /// </summary> /// <param name="argument">Method call argument</param> public void LoadMmeStartAddressRam(int argument) @@ -173,12 +171,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo } /// <summary> - /// Change the shadow RAM setting + /// Changes the shadow RAM control. /// </summary> /// <param name="argument">Method call argument</param> public void SetMmeShadowRamControl(int argument) { - ShadowCtrl = (ShadowRamControl)argument; + _parent.SetShadowRamControl((ShadowRamControl)argument); } /// <summary> @@ -208,7 +206,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo /// <param name="state">Current GPU state</param> public void CallMme(int index, GpuState state) { - _macros[index].Execute(_macroCode, ShadowCtrl, state); + _macros[index].Execute(_macroCode, state); } } } diff --git a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs index 115361f3..32fd8b73 100644 --- a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs +++ b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs @@ -39,8 +39,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo { _context = context; - _fifoClass = new GPFifoClass(context); - + _fifoClass = new GPFifoClass(context, this); _subChannels = new GpuState[8]; for (int index = 0; index < _subChannels.Length; index++) @@ -152,7 +151,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo } else if (meth.Method < 0xe00) { - _subChannels[meth.SubChannel].CallMethod(meth, _fifoClass.ShadowCtrl); + _subChannels[meth.SubChannel].CallMethod(meth); } else { @@ -175,5 +174,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo } } } + + /// <summary> + /// Sets the shadow ram control value of all sub-channels. + /// </summary> + /// <param name="control">New shadow ram control value</param> + public void SetShadowRamControl(ShadowRamControl control) + { + for (int i = 0; i < _subChannels.Length; i++) + { + _subChannels[i].ShadowRamControl = control; + } + } } } |
