simvx.graphics.renderer.text_pass

2D text overlay pass using MSDF atlas: renders after 3D geometry.

Module Contents

Classes

TextPass

GPU text rendering with MSDF atlas, proper CFFI pipeline.

Data

API

simvx.graphics.renderer.text_pass.__all__

[‘TextPass’]

simvx.graphics.renderer.text_pass.log

‘getLogger(…)’

simvx.graphics.renderer.text_pass.VERTEX_STRIDE

32

simvx.graphics.renderer.text_pass.MAX_CHARS

4096

simvx.graphics.renderer.text_pass.VERTEX_BUF_SIZE

None

simvx.graphics.renderer.text_pass.INDEX_BUF_SIZE

None

class simvx.graphics.renderer.text_pass.TextPass(engine: Any)

GPU text rendering with MSDF atlas, proper CFFI pipeline.

Initialization

setup() None

Initialize GPU resources.

property pipeline: Any
property pipeline_layout: Any
pipeline_for(render_pass: Any, extent: tuple[int, int]) Any

Return the MSDF pipeline compiled against render_pass.

The default :attr:pipeline targets the swapchain (sRGB). Text drawn into an offscreen RTT target (a SubViewport’s R16F colour) needs a pipeline compiled against that pass – a different colour format is render-pass- INCOMPATIBLE, so the swapchain pipeline silently fails to draw there. This lazily builds + caches one pipeline per distinct render_pass (keyed by id); the layout is shared (same descriptor set / push constants). Returns the default pipeline when render_pass is the engine’s main pass.

property descriptor_set: Any
property px_range: float
property atlas_version: int
upload_atlas_if_dirty() None

Upload the shared TextRenderer’s atlas if its version changed.

Also checks Draw2D’s atlas (same shared atlas after unification). Must be called outside the render pass (staging transfers).

upload_atlas(atlas_data: numpy.ndarray, version: int = 1, px_range: float = 4.0) None

Upload MSDF atlas (RGBA uint8) to GPU via staging buffer.

Skips upload if the GPU already has this version. On version change, destroys old image/view/memory before creating new ones.

upload_geometry(vertices: numpy.ndarray, indices: numpy.ndarray) None

Upload per-frame text vertex/index data.

render(cmd: Any, width: int, height: int) None

Record text draw commands into the active render pass.

cleanup() None

Release all GPU resources.