class render::Renderer

Primarily rendering class that allows you to specify how to render objects that exist in the scene graph.

You need to provide your own implementation of your class.

Public

Constructors

Renderer

Renderer() = default

Methods

~Renderer

virtual ~Renderer() = default

GetCurrentCommandBufferPool

GpuCommandBufferPool &GetCurrentCommandBufferPool()

Returns the command buffer pool for the current frame.

GetParameterSetPool

GpuParameterSetPool &GetParameterSetPool()

Returns the parameter set pool used for allocating GPU parameter sets.

Initialize

virtual void Initialize(const SPtr<GpuDevice> &gpuDevice)

Initializes the renderer with the provided GPU device.

Must be called before using the renderer.

Update

void Update()

Called every frame.

Triggers render task callbacks.

Destroy

virtual void Destroy()

Cleans up the renderer.

Must be called before the renderer is deleted.

GetName

virtual const StringID &GetName() const = 0

Name of the renderer.

Used by materials to find an appropriate variation for this renderer.

RenderAll

virtual void RenderAll(PerFrameData perFrameData) = 0

Called in order to render all currently active cameras.

CaptureSceneCubeMap

virtual void CaptureSceneCubeMap(RendererScene &scene, GpuCommandBuffer &commandBuffer, const SPtr<Texture> &cubemap, const Vector3 &position, const CaptureSettings &settings) = 0

Captures the scene at the specified location into a cubemap.

scene
Scene to capture.
commandBuffer
Command buffer on which to encode the capture.
cubemap
Cubemap to store the results in.
position
Position to capture the scene at.
settings
Settings that allow you to customize the capture.

CreateScene

virtual SPtr<RendererScene> CreateScene() = 0

CreateMeshDataInternal

virtual SPtr<RendererMeshData> CreateMeshDataInternal(u32 numVertices, u32 numIndices, VertexLayout layout, IndexType indexType = IT_32BIT)

Creates a new empty renderer mesh data.

CreateMeshDataInternal

virtual SPtr<RendererMeshData> CreateMeshDataInternal(const SPtr<MeshData> &meshData)

Creates a new renderer mesh data using an existing generic mesh data buffer.

RequestDebugFrameCapture

virtual void RequestDebugFrameCapture()

Queues GPU command capture of the next frame, if a frame capture is set up (e.g.

RenderDoc capture).

RequestScreenCapture

virtual void RequestScreenCapture(Camera *camera, TAsyncOp<SPtr<PixelData>> asyncOp)

Requests a screen capture for the specified camera.

camera
The camera whose view should be captured.
asyncOp
Async operation to complete when capture finishes.

AddExtension

void AddExtension(RendererExtension *extension)

Registers an extension object that will be called every frame, for each scene and view.

Allows external code to perform custom rendering interleaved with the renderer's output.

RemoveExtension

void RemoveExtension(RendererExtension *extension)

Unregisters an extension registered with AddRendererExtension().

AddTask

void AddTask(const SPtr<RendererTask> &task)

Registers a new task for execution on the render thread.

SetOptions

virtual void SetOptions(const SPtr<RendererOptions> &options)

Sets options used for controlling the rendering.

GetOptions

virtual SPtr<RendererOptions> GetOptions() const

Returns current set of options used for controlling the rendering.

Protected

Methods

InitializeOnRenderThread

virtual void InitializeOnRenderThread()

Performs the initialization on the render thread.

DestroyOnRenderThread

virtual void DestroyOnRenderThread()

Performs tear-down on the render thread.

ProcessTasks

void ProcessTasks(bool forceAll, u64 upToFrame = std::numeric_limits<u64>::max())

Executes all renderer tasks queued for this frame.

forceAll
If true, multi-frame tasks will be forced to execute fully within this call.
upToFrame
Only tasks that were queued before or during the frame with the provided index will be processed.

ProcessTask

void ProcessTask(RendererTask &task, bool forceAll)

Executes the provided renderer task.

task
Task to execute.
forceAll
If true, multi-frame tasks will be forced to execute fully within this call.

Fields

mDevice

SPtr<GpuDevice> mDevice

mCommandBufferPoolRing

UPtr<GpuCommandBufferPoolRing> mCommandBufferPoolRing

mParameterSetPool

UPtr<GpuParameterSetPool> mParameterSetPool

mRendererExtensions

mRendererExtensionsDirty

bool mRendererExtensionsDirty

mQueuedTasks

Vector<RendererTaskQueuedInfo> mQueuedTasks

mUnresolvedTasks

Vector<SPtr<RendererTask>> mUnresolvedTasks

mRemainingUnresolvedTasks

Vector<SPtr<RendererTask>> mRemainingUnresolvedTasks

mRunningTasks

Vector<SPtr<RendererTask>> mRunningTasks

mRemainingTasks

Vector<SPtr<RendererTask>> mRemainingTasks

mTaskMutex

Mutex mTaskMutex