/// <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 HLE macro handler. /// </summary> /// <param name="context">GPU context the macro is being executed on</param> /// <param name="memoryManager">GPU memory manager</param> /// <param name="engine">3D engine where this macro is being called</param> /// <param name="functionName">Name of the HLE macro function to be called</param> public MacroHLE(GPFifoProcessor processor, MacroHLEFunctionName functionName) { _processor = processor; _functionName = functionName; Fifo = new Queue <FifoWord>(); }
/// <summary> /// Creates a new instance of a GPU channel. /// </summary> /// <param name="context">GPU context that the channel belongs to</param> internal GpuChannel(GpuContext context) { _context = context; _device = context.GPFifo; _processor = new GPFifoProcessor(context, this); BufferManager = new BufferManager(context, this); TextureManager = new TextureManager(context, this); }