/// <summary> /// Sets the first argument for the macro call. /// </summary> /// <param name="context">GPU context where the macro code is being executed</param> /// <param name="processor">GPU GP FIFO command processor</param> /// <param name="code">Code to be executed</param> /// <param name="argument">First argument</param> public void StartExecution(GpuContext context, GPFifoProcessor processor, ReadOnlySpan <int> code, int argument) { _argument = argument; _executionPending = true; if (_executionEngine == null) { if (GraphicsConfig.EnableMacroHLE && MacroHLETable.TryGetMacroHLEFunction(code.Slice(Position), context.Capabilities, out _hleFunction)) { _executionEngine = new MacroHLE(processor, _hleFunction); } else if (GraphicsConfig.EnableMacroJit) { _executionEngine = new MacroJit(); } else { _executionEngine = new MacroInterpreter(); } } if (_hleFunction == MacroHLEFunctionName.MultiDrawElementsIndirectCount) { // We don't consume the parameter buffer value, so we don't need to flush it. // Doing so improves performance if the value was written by a GPU shader. context.GPFifo.SetFlushSkips(2); } }
/// <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; _executionEngine = null; _executionPending = false; _argument = 0; _hleFunction = MacroHLEFunctionName.None; }
/// <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; if (GraphicsConfig.EnableMacroJit) { _executionEngine = new MacroJit(); } else { _executionEngine = new MacroInterpreter(); } }