40b21cc3c4
* 3D engine now uses DeviceState too, plus new state modification tracking * Remove old methods code * Remove GpuState and friends * Optimize DeviceState, force inline some functions * This change was not supposed to go in * Proper channel initialization * Optimize state read/write methods even more * Fix debug build * Do not dirty state if the write is redundant * The YControl register should dirty either the viewport or front face state too, to update the host origin * Avoid redundant vertex buffer updates * Move state and get rid of the Ryujinx.Graphics.Gpu.State namespace * Comments and nits * Fix rebase * PR feedback * Move changed = false to improve codegen * PR feedback * Carry RyuJIT a bit more
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using Ryujinx.Graphics.Device;
|
|
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, IDeviceState state, int arg0)
|
|
{
|
|
if (_execute == null)
|
|
{
|
|
MacroJitCompiler compiler = new MacroJitCompiler();
|
|
|
|
_execute = compiler.Compile(code);
|
|
}
|
|
|
|
_execute(_context, state, arg0);
|
|
}
|
|
}
|
|
}
|