Windows (DirectX 12) |
Linux (Vulkan) |
MacOS (Metal) |
iOS (Metal) |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
This tutorial demonstrates multithreaded rendering with Rhi::ParallelRenderCommandList
using Methane Kit:
- ParallelRenderingApp.h
- ParallelRenderingApp.cpp
- ParallelRenderingAppController.h
- ParallelRenderingAppController.cpp
- Shaders/ParallelRendering.hlsl
- Shaders/ParallelRenderingUniforms.h
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.
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:
- Methane::Platform::AppController
- Methane::Graphics::AppController, AppContextController
- Methane::UserInterface::AppController
Continue learning Methane Graphics programming in the next tutorial ConsoleCompute, which is demonstrating computing on GPU in pure console application.