simvx.graphics.renderer.draw2d_pass

2D drawing pass: renders Draw2D geometry using ui.vert + draw2d_fill.frag, plus MSDF text.

Fill fragments are modulated by the Light2DPass accumulation texture when any PointLight2D is present in the scene (multiply blend with an ambient floor). With no lights submitted, the composite is a bypass and fills render with their unlit vertex colour.

Module Contents

Classes

Draw2DPass

GPU pass that renders 2D fills (triangles), lines, and MSDF text from Draw2D buffers.

Data

API

simvx.graphics.renderer.draw2d_pass.__all__

[‘Draw2DPass’]

simvx.graphics.renderer.draw2d_pass.log

‘getLogger(…)’

simvx.graphics.renderer.draw2d_pass.MAX_FILL_VERTS

131072

simvx.graphics.renderer.draw2d_pass.MAX_LINE_VERTS

32768

simvx.graphics.renderer.draw2d_pass.VERTEX_STRIDE

32

simvx.graphics.renderer.draw2d_pass.MAX_FILL_INDICES

196608

simvx.graphics.renderer.draw2d_pass.MAX_TEXT_VERTS

32768

simvx.graphics.renderer.draw2d_pass.MAX_TEXT_INDICES

49152

simvx.graphics.renderer.draw2d_pass.MAX_TEX_VERTS

16384

simvx.graphics.renderer.draw2d_pass.MAX_TEX_INDICES

24576

simvx.graphics.renderer.draw2d_pass.FILL_PUSH_SIZE

48

class simvx.graphics.renderer.draw2d_pass.Draw2DPass(engine: Any, text_pass: Any = None, light2d_pass: Any = None)[source]

GPU pass that renders 2D fills (triangles), lines, and MSDF text from Draw2D buffers.

Text rendering shares the TextPass’s pipeline, descriptor set, and atlas: only the text vertex/index buffers are owned here (needed for per-batch scissor clipping).

Initialization

__slots__

(‘_engine’, ‘_text_pass’, ‘_light2d_pass’, ‘_fill_pipeline’, ‘_fill_pipeline_layout’, ‘_fill_desc_la…

setup(render_pass: Any = None, extent: tuple[int, int] | None = None) None[source]

Create pipelines and allocate GPU buffers.

Args: render_pass: Vulkan render pass to compile pipelines against. Defaults to the engine’s main (swapchain) render pass. extent: Framebuffer extent (width, height). Defaults to engine extent.

render(cmd: Any, width: int, height: int, ui_width: int = 0, ui_height: int = 0, ops: list | None = None) None[source]

Render 2D geometry in submission order.

Walks Draw2D._ops (or the provided ops list, e.g. an isolated play-mode tree), coalesces adjacent same-(kind, clip, tex_id) ops into one GPU draw, and emits draws in submission order, so the order in which draw_rect / draw_text / draw_texture calls happen in on_draw is the order they hit the framebuffer.

Args: ops: Pre-extracted op list. If None, pulls from Draw2D singleton.

cleanup() None[source]