parent
c11855565e
commit
60db4c3530
13 changed files with 774 additions and 159 deletions
39
Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs
Normal file
39
Ryujinx.Graphics.Gpu/Engine/MME/MacroJit.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using Ryujinx.Graphics.Gpu.State;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a execution engine that uses a Just-in-Time compiler for fast execution.
|
||||
/// </summary>
|
||||
class MacroJit : IMacroEE
|
||||
{
|
||||
private readonly MacroJitContext _context = new MacroJitContext();
|
||||
|
||||
/// <summary>
|
||||
/// Arguments FIFO.
|
||||
/// </summary>
|
||||
public Queue<int> Fifo => _context.Fifo;
|
||||
|
||||
private MacroJitCompiler.MacroExecute _execute;
|
||||
|
||||
/// <summary>
|
||||
/// Executes a macro program until it exits.
|
||||
/// </summary>
|
||||
/// <param name="code">Code of the program to execute</param>
|
||||
/// <param name="state">Current GPU state</param>
|
||||
/// <param name="arg0">Optional argument passed to the program, 0 if not used</param>
|
||||
public void Execute(ReadOnlySpan<int> code, GpuState state, int arg0)
|
||||
{
|
||||
if (_execute == null)
|
||||
{
|
||||
MacroJitCompiler compiler = new MacroJitCompiler();
|
||||
|
||||
_execute = compiler.Compile(code);
|
||||
}
|
||||
|
||||
_execute(_context, state, arg0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue