Static facade for all renderer operations. More...
#include <IllumineRenderer.h>
Static Public Member Functions | |
| static ILLUMINE_API void | Init (Window &wnd, const RendererConfig &config) |
| Initializes the renderer, render thread, and all GPU resources. | |
| static ILLUMINE_API void | Shutdown () |
| Shuts down the renderer and releases all GPU and CPU resources. | |
| static ILLUMINE_API void | WaitRender () |
| Blocks the calling thread until the GPU is fully idle. | |
| static ILLUMINE_API void | SwapQueues () |
| Swaps the write and read command queues, kicking the render thread. | |
| static ILLUMINE_API void | FlushAndWait () |
| Submits the current queue and blocks until the render thread AND GPU have fully completed execution. | |
| static ILLUMINE_API void | BeginFrame () |
| Enqueues the swapchain acquire and command buffer begin onto the render thread. | |
| static ILLUMINE_API void | EndFrame () |
| Enqueues the command buffer end, queue submit, and swapchain present. | |
| template<typename Fn> | |
| static void | SubmitCmd (Fn &&fn) |
| Allocates a render command in the current write queue. | |
| static ILLUMINE_API void | BeginRenderPass (Ref< RenderPass > renderPass) |
| Enqueues a render pass begin command. | |
| static ILLUMINE_API void | EndRenderPass () |
| Enqueues a render pass end command. | |
| static ILLUMINE_API void | DrawGeometry (Ref< Pipeline > pipeline, Ref< VertexBuffer > vertexBuffer, Ref< IndexBuffer > indexBuffer, const Crux::mat4 &transform) |
| Enqueues a draw call for indexed geometry. | |
| static ILLUMINE_API void | DrawGeometryIndexed (Ref< VertexBuffer > vertexBuffer, Ref< IndexBuffer > indexBuffer, u32 indexCount) |
| Enqueues a draw call for indexed geometry. | |
| static ILLUMINE_API void | DrawGeometryRaw (Ref< VertexBuffer > vertexBuffer, u32 vertexCount) |
| Enqueues a draw call for geometry. | |
| static ILLUMINE_API void | DrawStaticMesh (Ref< Pipeline > pipeline, Ref< Mesh > mesh, const Crux::mat4 &transform, const Crux::Frustum &frustum) |
| Enqueues draw calls for all submeshes of a static mesh. | |
| static ILLUMINE_API void | DrawStaticMeshDepthOnly (Ref< Pipeline > pipeline, Ref< Mesh > mesh, const Crux::mat4 &transform, const Crux::Frustum &frustum) |
| static ILLUMINE_API void | DrawSkybox (Ref< Pipeline > pipeline, Ref< VertexBuffer > vb) |
| static ILLUMINE_API void | DrawFullscreenQuad (Ref< Pipeline > pipeline, Ref< VertexBuffer > vb, Ref< IndexBuffer > ib) |
| static ILLUMINE_API void | Submit (const StaticMeshSubmission &s) |
| Submits a static mesh for rendering this frame. | |
| static ILLUMINE_API const std::vector< StaticMeshSubmission > & | GetStaticMeshSubmissions () |
| Returns all static mesh submissions queued for the current frame. | |
| static ILLUMINE_API void | BeginGPUPerf (const std::string &name) |
| Enqueues a GPU timestamp begin marker. | |
| static ILLUMINE_API void | EndGPUPerf () |
| Enqueues a GPU timestamp end marker. | |
| static ILLUMINE_API std::vector< GPUTimeSpan > | GetGPUTimes () |
| Returns all GPU time spans recorded in the last completed frame. | |
| static ILLUMINE_API void | DrainPendingPresent () |
| static ILLUMINE_API Ref< RenderCommandBuffer > | GetCommandBuffer () |
| Returns the command buffer for the current frame slot. | |
| static ILLUMINE_API Ref< RenderCommandBuffer > | GetCommandBuffer (u8 index) |
| Returns the command buffer at an explicit frame index. | |
| static ILLUMINE_API u32 | GetImageIndex () |
| Returns the current swapchain image index. | |
| static ILLUMINE_API void * | BeginSingleTimeCommand () |
| Allocates and begins a one-shot command buffer on the graphics queue. | |
| static ILLUMINE_API void | EndSingleTimeCommand (void *commandBuffer) |
| Ends and submits a one-shot command buffer, then frees it. | |
| static ILLUMINE_API void | TransitionImageLayout (Ref< Image2D > image, ImageFormat format, ImageLayout oldLayout, ImageLayout newLayout, u32 mipCount=0) |
| Transitions a Vulkan image between layout states. | |
| static ILLUMINE_API void | CopyBuffer (void *srcBuffer, void *dstBuffer, u32 size) |
| Copies data between two Vulkan buffers synchronously. | |
| static ILLUMINE_API void | CopyBufferToImage (void *srcBuffer, void *dstImage, u32 width, u32 height) |
| Copies buffer data into a Vulkan image synchronously. | |
| static ILLUMINE_API Ref< ShaderLibrary > | GetShaderLibrary () |
| Returns the global shader library. | |
| static ILLUMINE_API Ref< MaterialRegistry > | GetMaterialRegistry () |
| Returns the global material registry. | |
| static ILLUMINE_API RendererConfig & | GetConfig () |
| Returns the current renderer configuration. | |
| static ILLUMINE_API RendererData & | GetRenderData () |
| Returns current frame statistics and shared renderer resources. | |
| static ILLUMINE_API RenderResourceRegistry & | GetResourceRegistry () |
| Returns the render resource registry. | |
| static Window & | GetWindow () |
| Returns the window the renderer is rendering into. | |
| static Swapchain & | GetSwapchain () |
| Returns the active swapchain. | |
| static ILLUMINE_API void * | GetDescriptorPool () |
| Returns the raw Vulkan descriptor pool handle. | |
| static ILLUMINE_API void * | GetInstance () |
| Returns the raw Vulkan instance handle. | |
| static RendererAPI & | GetRendererAPI () |
| Returns the underlying RendererAPI implementation. | |
| static bool | ShouldRecreateSwapchain () |
| static bool | ShouldResizeFramebuffers () |
| static void | QueueRecreate () |
| static void | QueueResize () |
| static void | Recreated () |
| static ILLUMINE_API void | SetVSync (bool enabled) |
| Enable or disable vertical synchronization. | |
| static ILLUMINE_API void | RequestPresent () |
| static ILLUMINE_API void | InitCommandBuffers () |
| Initializes Vulkan command buffers for all frame slots. | |
| static ILLUMINE_API void | TransitionImage (Ref< Image2D > image, ResourceState newState) |
| static ILLUMINE_API void | FullBarrier () |
| static ILLUMINE_API void | StorageWriteToComputeRead () |
| static ILLUMINE_API void | StorageWriteToFragmentRead () |
| static ILLUMINE_API void | DepthWriteToComputeRead () |
| static ILLUMINE_API void | ComputeReadToDepthWrite () |
Static Public Attributes | |
| static constexpr u32 | MAX_FRAMES_IN_FLIGHT = 4 |
| Maximum supported frames in flight. Matches semaphore template parameter. | |
Static facade for all renderer operations.
All public methods are safe to call from the main thread unless explicitly documented as render-thread-only. See file-level documentation for the full threading model and SubmitCmd usage rules.
|
static |
Enqueues the swapchain acquire and command buffer begin onto the render thread.
Internally calls SubmitCmd. Must be called after SwapQueues() each frame. The render thread will acquire the next swapchain image and begin recording.
|
static |
Enqueues a GPU timestamp begin marker.
| name | Label for the time span. Displayed in profiling tools. |
|
static |
Enqueues a render pass begin command.
| renderPass | The render pass to begin. Captured by value. |
Sets viewport, scissor, and clears attachments as specified in the render pass framebuffer specification. Must be paired with EndRenderPass().
|
static |
Allocates and begins a one-shot command buffer on the graphics queue.
Used for immediate GPU operations such as buffer uploads, image layout transitions, and texture copies during resource initialization. Must be paired with EndSingleTimeCommand().
|
static |
|
static |
Copies data between two Vulkan buffers synchronously.
| srcBuffer | Source VkBuffer (as void*). |
| dstBuffer | Destination VkBuffer (as void*). |
| size | Number of bytes to copy. |
|
static |
Copies buffer data into a Vulkan image synchronously.
| srcBuffer | Source VkBuffer (as void*). |
| dstImage | Destination VkImage (as void*). |
| width | Width of the target image region. |
| height | Height of the target image region. |
|
static |
|
static |
|
static |
|
static |
Enqueues a draw call for indexed geometry.
| pipeline | Graphics pipeline to bind. |
| vertexBuffer | Vertex buffer containing geometry data. |
| indexBuffer | Index buffer defining draw topology. |
| transform | Model matrix pushed as a push constant. |
|
static |
Enqueues a draw call for indexed geometry.
| vertexBuffer | Vertex buffer containing geometry data. |
| indexBuffer | Index buffer defining draw topology. |
| indexCount | The amount of indices. |
|
static |
Enqueues a draw call for geometry.
| vertexBuffer | Vertex buffer containing geometry data. |
| vertexCount | The amount of indices. |
|
static |
|
static |
Enqueues draw calls for all submeshes of a static mesh.
| pipeline | Graphics pipeline to bind. |
| mesh | Static mesh containing vertex buffer, index buffer, and submesh list. |
| transform | Model matrix pushed as a push constant. |
Iterates submeshes, binds per-submesh materials, and issues one vkCmdDrawIndexed per submesh.
|
static |
|
static |
Enqueues the command buffer end, queue submit, and swapchain present.
Internally calls SubmitCmd. Must be called at the end of each frame after all draw commands have been submitted. Presentation is deferred to the render thread.
|
static |
Enqueues a GPU timestamp end marker.
Must be paired with a preceding BeginGPUPerf() call.
|
static |
Enqueues a render pass end command.
Must be called after BeginRenderPass() and all draw commands for that pass.
|
static |
Ends and submits a one-shot command buffer, then frees it.
| commandBuffer | Pointer returned by BeginSingleTimeCommand(). |
Calls vkQueueWaitIdle after submission. The command buffer is freed back to the command pool on return.
|
static |
Submits the current queue and blocks until the render thread AND GPU have fully completed execution.
Performs a full CPU + GPU drain. Significantly more expensive than SwapQueues(). Only use during Shutdown. Prefer Framework::SyncPoint + WaitRender
|
static |
|
static |
Returns the command buffer for the current frame slot.
|
static |
Returns the command buffer at an explicit frame index.
| index | Frame slot index. Must be < FramesInFlight. |
|
static |
Returns the current renderer configuration.
|
static |
Returns the raw Vulkan descriptor pool handle.
Exposed for low-level descriptor set allocation (e.g. ImGui integration).
|
static |
Returns all GPU time spans recorded in the last completed frame.
|
static |
Returns the current swapchain image index.
|
static |
Returns the raw Vulkan instance handle.
|
static |
Returns the global material registry.
|
static |
Returns current frame statistics and shared renderer resources.
|
inlinestatic |
Returns the underlying RendererAPI implementation.
|
static |
Returns the render resource registry.
|
static |
Returns the global shader library.
|
static |
Returns all static mesh submissions queued for the current frame.
|
inlinestatic |
Returns the active swapchain.
|
inlinestatic |
Returns the window the renderer is rendering into.
|
static |
Initializes the renderer, render thread, and all GPU resources.
| wnd | Reference to the application window to render into. |
| config | Renderer configuration. FramesInFlight is clamped to [1, MAX_FRAMES_IN_FLIGHT]. |
Creates the RendererAPI backend, swapchain, command pools, command queues, shader library, material registry, and starts the render thread. Must be called before any other IllumineRenderer function.
|
static |
Initializes Vulkan command buffers for all frame slots.
Allocates one command buffer per frame in flight from the graphics command pool. Called automatically during Init(). May be called again after device loss recovery.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
Enable or disable vertical synchronization.
| enabled | True to enable VSync, false to disable. |
|
inlinestatic |
|
inlinestatic |
|
static |
Shuts down the renderer and releases all GPU and CPU resources.
Calls FlushAndWait() to drain all in-flight work, then signals the render thread to exit and joins it. Safe to call only from the main thread. No IllumineRenderer functions may be called after Shutdown().
|
static |
|
static |
|
static |
Submits a static mesh for rendering this frame.
| s | Submission data including mesh handle and transform. |
Adds the submission to the current frame's submission list, which is consumed by SceneRenderer::EndScene(). Cleared at the end of each frame by the render thread.
|
inlinestatic |
Allocates a render command in the current write queue.
The functor is placement-new'd into the queue's linear memory buffer and executed on the render thread during the next Execute() pass. The functor's destructor is called immediately after execution.
Alignment is handled automatically.
| Fn | Callable type. Must be moveable and destructible. |
| fn | Functor to enqueue. Captured by forward — prefer lambdas with explicit capture lists. |
|
static |
Swaps the write and read command queues, kicking the render thread.
The current write queue is handed off to the render thread for execution. Main thread immediately begins filling the next queue. Blocks only if the render thread is MAX_FRAMES_IN_FLIGHT frames behind (semaphore exhausted), which in practice should never happen under normal load.
Call once per frame at the top of the render loop, before BeginFrame().
|
static |
|
static |
Transitions a Vulkan image between layout states.
| image | Raw VkImage pointer (as void*). |
| format | Image format used to select the correct aspect mask. |
| oldLayout | Source image layout. |
| newLayout | Destination image layout. |
| mipCount | Number of mip levels to transition. Pass 0 for all levels. |
Executed synchronously via a single-time command buffer.
|
static |
Blocks the calling thread until the GPU is fully idle.
Equivalent to vkDeviceWaitIdle. Use sparingly — prefer FlushAndWait() for CPU/GPU sync and SwapQueues() for normal frame pacing.
|
staticconstexpr |
Maximum supported frames in flight. Matches semaphore template parameter.