Parallel Rendering Overview
- Originally the renderer ran in the Render Thread with commands enqueued by the Game Thread; they call into the RHI (cross-platform interface to graphics APIs).
- Now Render Thread is a frontend enqueuing platform-agnostic commands into command lists; a new RHI Thread translates them via the graphics API on the backend; enables backend parallelization (consoles, DX12, Vulkan). "anything generated in parallel on the frontend is translated in parallel on the backend."
- Lock/Unlock issued directly by Render Thread: engine flushes RHI thread and waits, or copies data and queues it.
- Commands are FRHICommand-derived structs with Execute; IRHICommandContext per platform/API does state shadowing, validation.
- Synchronization: normally "single frame behind": RenderThread processes Frame N while GameThread processes N+1; RenderThread can move ahead of RHI Thread (visibility for N+1 while RHI translates N). Arbitrated by FFrameEndSync and RHIThreadFence. GPU submission order unchanged versus single-threaded renderer.
- CVars: r.rhicmdusedeferredcontexts 0 (disable backend parallelization), r.rhicmduseparallelalgorithms 0 (frontend), r.rhithread.enable 0, r.rhicmdbypass 1 (ignored unless RHI thread disabled).