Skip to content

Renderer / Render Backends ​

The render layer sits on its own thread and consumes render commands pushed from the application thread over the SPSC ring queue. It replays the commands as tgfx draws: a tgfx Window owns the GPU context and swapchain on every platform, and context->submit() presents each frame. The concrete GPU backend is tgfx's own compile-time TGFX_USE_* choice — there is no runtime backend flag (see GPU backend).

RenderLayer ​

cpp
class RenderLayer;  // obtained via Application::GetRenderLayer()

You normally never construct it directly. Application owns it and exposes it through:

cpp
RenderLayer& Application::GetRenderLayer() noexcept;

It owns the tgfx device (through TgfxRenderer), the command sink, and presents each frame.

GlfwBridge (desktop window & input) ​

cpp
class GlfwBridge : public NonCopyable;

Header: <neoflux/renderers/glfw_bridge.h>. Wraps the GLFW window (created with GLFW_NO_API) and translates OS input into NeoFlux callbacks. It is a pure window + input bridge: GPU context, surface, and presentation belong to the tgfx Window inside TgfxRenderer.

MethodSignatureNotes
Initbool Init(int w, int h, std::string_view title)create window (GLFW_NO_API).
Shutdownvoid Shutdown() noexcept
PollEventsvoid PollEvents() constnon-blocking.
ShouldClosebool ShouldClose() const
GetFramebufferSizevoid GetFramebufferSize(int& w, int& h) const
GetWindowSizevoid GetWindowSize(int& w, int& h) const
GetNativeHandleGLFWwindow* GetNativeHandle() const noexcepthanded to TgfxRenderer::Init.
GetCursorPosPoint GetCursorPos() const noexcept

Input callback setters: SetInputCallback, SetScrollCallback, SetResizeCallback, SetMouseMoveCallback.

gflag reference ​

All flags are parsed from argc/argv passed to Application::Init.

FlagTypeDefaultMeaning
--target_fpsint3260Frame rate cap for the event loop.
--render_queue_capacityuint642048SPSC ring-queue slots. Rounded up to a power of two; usable slots = capacity - 1.
--verbose_loggingboolfalseEnable verbose (debug) logging.
--logtostderrboolfalseEmit glog to stderr instead of files.
--log_dirstring"./logs"Directory for glog log files.

Example ​

powershell
.\my_app.exe --target_fps=30 --verbose_logging --logtostderr
bash
./my_app --render_queue_capacity=4096 --log_dir=./logs

Backend selection is compile-time

There is no runtime backend flag. Switching GPU backends means re-running CMake with a different TGFX_USE_* switch and rebuilding — see GPU backend.

Comments

Released under the GPL-3.0 License.