Skip to content

Latest commit

History

History

07-ParallelRendering

Parallel Rendering Tutorial

Windows (DirectX 12)       
Linux (Vulkan)             
MacOS (Metal)              
iOS (Metal)
ParallelRendering on Windows ParallelRendering on Linux ParallelRendering on MacOS ParallelRendering on iOS

This tutorial demonstrates multithreaded rendering with Rhi::ParallelRenderCommandList using Methane Kit:

Tutorial demonstrates the following techniques:

  • Creating render target texture 2D array;
  • Rendering text labels to the faces of texture 2D array via separate render passes using helper class TextureLabeler;
  • Using MeshBuffers extension primitive to represent cube instances, create index and vertex buffers and render with a single Draw command.
  • Using single addressable uniforms buffer to store an array of uniform structures for all cube instance parameters at once and binding array elements in that buffer to the particular cube instance draws with byte offset in buffer memory.
  • Binding faces of the texture 2D array to the cube instances to display rendering thread number as text on cube faces.
  • Using TaskFlow library for task-based parallelism and parallel for loops.
  • Randomly distributing cubes between render threads and rendering them in parallel using IParallelRenderCommandList all to the screen render pass.
  • Use Methane instrumentation to profile application execution on CPU and GPU using Tracy or Intel GPA Trace Analyzer.

Application Controls

Keyboard actions are enabled with ParallelRenderingAppController class derived from Platform::Input::Keyboard::ActionControllerBase:

Parallel Rendering App Action Keyboard Shortcut
Switch Parallel Rendering P
Increase Cubes Grid Size +
Decrease Cubes Grid Size -
Increase Render Threads Count ]
Decrease Render Threads Count [

Common keyboard controls are enabled by the Platform, Graphics and UserInterface application controllers:

Continue learning

Continue learning Methane Graphics programming in the next tutorial ConsoleCompute, which is demonstrating computing on GPU in pure console application.