vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::RenderBackend Class Referenceabstract

The frame's seam between the engine and the graphics API. More...

#include <render_backend.h>

Public Member Functions

virtual bool init (WindowManager &window)=0
 Bring the backend up against the window.
virtual void render (const RenderView &view, const ResourceManager &resources)=0
 Draw one frame into the window's back buffer, for the engine loop to present.
virtual bool readFrame (const RenderView &view, std::vector< uint8_t > &pixels)
 Read back the frame render() last drew, as the window shows it.
virtual uint32_t reloadChangedShaders ()
 Recompile shaders whose source changed on disk - a dev hook.
virtual uint32_t maxAnisotropy () const
 The highest anisotropic-filtering degree this backend can honour.
virtual bool holdsPixels (const Handle< TextureAsset > &texture, uint64_t version) const
 Whether the backend holds its own copy of a texture's pixels.
virtual EditorRenderHooks * editorHooks ()
 The backend's authoring-only hooks, or null when it offers none.

Protected Member Functions

void setInfo (BackendInfo info)
 What info() reports, once init() knows the API and the device.

Detailed Description

The frame's seam between the engine and the graphics API.

The backend gets one POD RenderView per frame and owns all GPU state below this line; the window owns the API context and Engine::run presents. Nothing above holds an API object.

Member Function Documentation

◆ init()

virtual bool Vkm::Engine::RenderBackend::init ( WindowManager & window)
pure virtual

Bring the backend up against the window.

The window's API context is current. False when the device cannot run this backend.

Parameters
windowThe window whose context the backend draws into.
Returns
True when the backend can draw.

◆ render()

virtual void Vkm::Engine::RenderBackend::render ( const RenderView & view,
const ResourceManager & resources )
pure virtual

Draw one frame into the window's back buffer, for the engine loop to present.

The view carries the viewport and surface size; a backend detects a resize by comparing against its own cached values.

Parameters
viewWhat to draw this frame.
resourcesResolves the view's handles; only changed data is uploaded.

◆ readFrame()

virtual bool Vkm::Engine::RenderBackend::readFrame ( const RenderView & view,
std::vector< uint8_t > & pixels )
inlinevirtual

Read back the frame render() last drew, as the window shows it.

The viewport after every pass, UI included. Called right after render() in the same frame, so a backend presenting in render() reads first. Leaves no API state behind.

Parameters
viewThe view render() was handed; its viewport is the rect read.
pixelsReplaced with tightly packed 8-bit RGB, top row first.
Returns
False, with pixels empty, when this backend cannot read back.

◆ reloadChangedShaders()

virtual uint32_t Vkm::Engine::RenderBackend::reloadChangedShaders ( )
inlinevirtual

Recompile shaders whose source changed on disk - a dev hook.

Cheap enough per frame (a directory scan and timestamp compare). A failing edit keeps the old program and logs. A no-op without sources on disk.

Returns
Number of shaders recompiled.

◆ maxAnisotropy()

virtual uint32_t Vkm::Engine::RenderBackend::maxAnisotropy ( ) const
inlinevirtual

The highest anisotropic-filtering degree this backend can honour.

What the driver reports; a setting should offer nothing above it.

Returns
Maximum degree; 1 means none.

◆ holdsPixels()

virtual bool Vkm::Engine::RenderBackend::holdsPixels ( const Handle< TextureAsset > & texture,
uint64_t version ) const
inlinevirtual

Whether the backend holds its own copy of a texture's pixels.

Asked before the CPU copy is freed (see RenderSystem::releaseUploadedPixels).

Parameters
textureThe texture asked about.
versionIts asset's current Resource::version.
Returns
True only when the backend's copy is of that version.

◆ editorHooks()

virtual EditorRenderHooks * Vkm::Engine::RenderBackend::editorHooks ( )
inlinevirtual

The backend's authoring-only hooks, or null when it offers none.

Returns
Hooks the editor may use, or null.

The documentation for this class was generated from the following file: