A Multithreaded Approach to a Rendering Pipeline
By Russell O’Heney
Over the last few years, the rate of processor speed advancements has slowed considerably as CPU manufacturers have faced tough challenges including those of trying to manage rising heat levels and deal with power inefficiencies. As such, there has been a concerted push towards systems comprising of multiple cores, designed to work in parallel to provide additional processing power; consequently this shift has made the task of the programmer more complex since code must be structured to take advantage of additional cores. Video card manufacturers have already started rolling out multithreaded drivers that make use of additional cores to parallelize driver overhead where possible.
This article presents a strategy for dedicating a rendering thread to the process of running the rendering pipeline and addresses the issues of synchronization with other subsystems running on the main game thread. The rendering pipeline can consume significant CPU overhead; we exploit the fact that a clear separation can be made between rendering subsystems and game-related code (code other than the rendering pipeline) to allow us to utilize an additional core in parallel. This approach could be used to take advantage of multi-core PCs and next-gen platforms such as the Xbox 360. Where appropriate, code snippets correspond to a Direct3D 9 Windows platform, although the principles are intended to apply in a more general sense. To the extent possible, reference will also be made to Xbox 360 in order to highlight certain platform differences that may influence key design decisions in aiming for a more generic, cross-platform pipeline.
Biography
Russell O’Heney has worked in the games industry since early 2002 and has contributed to a number of published titles which include Race Driver 3, LMA Manager and the Club Football series while working for Codemasters Software, UK. Most recently he worked as graphics programmer for Rockstar Games in Vienna, Austria, working on next-generation technology.