using Ryujinx.Graphics.Gpu.State;
using System;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Gpu.Engine.MME
{
///
/// Represents a execution engine that uses a Just-in-Time compiler for fast execution.
///
class MacroJit : IMacroEE
{
private readonly MacroJitContext _context = new MacroJitContext();
///
/// Arguments FIFO.
///
public Queue Fifo => _context.Fifo;
private MacroJitCompiler.MacroExecute _execute;
///
/// Executes a macro program until it exits.
///
/// Code of the program to execute
/// Current GPU state
/// Optional argument passed to the program, 0 if not used
public void Execute(ReadOnlySpan code, GpuState state, int arg0)
{
if (_execute == null)
{
MacroJitCompiler compiler = new MacroJitCompiler();
_execute = compiler.Compile(code);
}
_execute(_context, state, arg0);
}
}
}