Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
IllumineRenderer.h File Reference

Central renderer interface wrapping the underlying RendererAPI. More...

#include "Renderer/Base.h"
#include "Raven/Core/System.h"
#include "Raven/Core/Window.h"
#include "Renderer/RendererAPI.h"
#include "Renderer/RenderCommandQueue.h"
#include "Renderer/RenderCommandBuffer.h"
#include "Renderer/RenderResourceRegistry.h"
#include "Renderer/RenderPass.h"
#include "Renderer/Swapchain.h"
#include "Renderer/Pipeline.h"
#include "Renderer/VertexBuffer.h"
#include "Renderer/IndexBuffer.h"
#include "Renderer/Mesh.h"
#include "Renderer/Submission.h"
#include <semaphore>
#include <vector>

Classes

struct  Raven::RendererConfig
 Configuration options controlling renderer behavior at startup. More...
struct  Raven::RendererData
 Runtime statistics and shared renderer resources. More...
class  Raven::IllumineRenderer
 Static facade for all renderer operations. More...

Namespaces

namespace  Raven

Detailed Description

Central renderer interface wrapping the underlying RendererAPI.

IllumineRenderer is a static facade over the platform- and API-agnostic RendererAPI implementation. It manages the render thread, double/triple/quad buffered command queues, frame lifecycle, mesh submissions, and shared GPU resources such as shaders, pipelines, and materials.

Threading Model
IllumineRenderer separates work into two threads:

  • Main thread — builds the command queue each frame via SubmitCmd(). Never touches Vulkan objects directly. Calls SwapQueues() once per frame to hand the filled queue to the render thread.
  • Render thread — owned entirely by IllumineRenderer. Drains the command queue, records Vulkan command buffers, and submits to the GPU.

Frame Lifecycle

// Application loop (main thread):
IllumineRenderer::SwapQueues(); // hand previous frame's queue to render thread
IllumineRenderer::BeginFrame(); // enqueues: swapchain acquire + cmd begin
// ... SubmitCmd() calls ...
IllumineRenderer::EndFrame(); // enqueues: cmd end + queue submit + present

Rules for SubmitCmd Lambdas

  • DO resolve GetCommandBuffer() inside the lambda body (render thread only).
  • DO capture Ref<> handles by value — they are refcounted and thread-safe.
  • DO snapshot main-thread state before submitting (e.g. mesh submission lists).
  • DO NOT capture raw VkCommandBuffer, VkPipeline, or other Vulkan handles resolved on the main thread — they may be stale by execution time.
  • DO NOT call SwapQueues() or FlushAndWait() from inside a lambda.
  • DO NOT call GetCommandBuffer() from the main thread.