Skip to content

Engine → Renderer

debug_draw.h

The engine-owned facade: immediate shapes and text (drawn for one frame) and timed shapes and text (kept for durationSeconds). Thread-safe; append_to() and tick() run on the main thread each frame. Immediate shapes are written straight into the frame list under the mutex; only timed shapes build a buffer of their own (outside the lock). Text is kept as text in two byte arenas (this frame's and the timed one) that keep their capacity, so a steady frame allocates nothing once they have grown, and append_to expands it into lines against the view it is given.

Structs

File Description
debug_draw::text_record One text call: where it is anchored, how it is drawn and where its bytes are in its arena.
debug_draw::timed_entry
debug_draw_stats What a debug_draw did with its text, and the size of its last append. The text counters are cumulative over the drawer's life.
debug_text_view The camera debug text faces, built by the engine's extraction from the main camera each frame. A viewportHeightPixels that is not a positive finite number means there is no view: the text queued for this frame is dropped and counted, and the timed text waits for an append that has a view.
debug_vertex One line vertex as the GPU consumes it (gpu_debug_vertex): position and an RGBA8 colour.

Classes

File Description
debug_draw The engine-owned facade: immediate shapes and text (drawn for one frame) and timed shapes and text (kept for durationSeconds). Thread-safe; append_to() and tick() run on the main thread each frame. Immediate shapes are written straight into the frame list under the mutex; only timed shapes build a buffer of their own (outside the lock). Text is kept as text in two byte arenas (this frame's and the timed one) that keep their capacity, so a steady frame allocates nothing once they have grown, and append_to expands it into lines against the view it is given.
debug_draw_buffer Line primitives collected for one frame. Each shape call appends pairs of vertices to the depth-tested or the overlay list; the lists are capped at MAX_DEBUG_VERTICES each (excess is dropped and counted).

Enumerations

debug_depth

enum class debug_depth : u8 {
    TESTED,
    OVERLAY
};

How a debug line meets the scene: hidden behind geometry (TESTED) or drawn on top (OVERLAY). A typed argument, so it can never be confused with the facade's duration in the same position.

Constants

Name Type Value Description
DEBUG_TEXT_PIXEL_HEIGHT inline constexpr f32 14.0f Cap height of debug text in framebuffer pixels at UI scale 1 (14 px at 100 %, 21 px at 150 %).
MAX_DEBUG_TEXT_ARENA_BYTES inline constexpr u32 64 * 1024 Bytes of queued debug text (this frame's and the timed text together) a debug_draw holds at most; a call that would go over it is dropped and counted.
MAX_DEBUG_TEXT_BYTES inline constexpr u32 1024 Bytes of UTF-8 one debug_draw::text call keeps; longer text is cut at a code point and counted.

Functions

Public

pack_debug_colour

[[nodiscard]] CONJURE_API u32 pack_debug_colour(
    const math::vec4 &colour) noexcept;

Packs a linear colour with components in [0, 1] into RGBA8 (red in the low byte).