simvx.graphics.renderer.mesh_registry

Mesh registry: manages uploaded GPU mesh buffers and returns handles.

One GPU buffer per vertex stream (the vertex-stream split): positions, normal+uv shading, optional extras (tangent/colour/uv2), optional skin (joints/weights), plus the index buffer. See vertex_layouts.py for the matching pipeline binding layouts.

Module Contents

Classes

MeshBuffers

The GPU buffers of one registered mesh, per vertex stream.

MeshRegistry

Upload meshes to GPU, return handles for efficient referencing.

Data

API

simvx.graphics.renderer.mesh_registry.log

‘getLogger(…)’

simvx.graphics.renderer.mesh_registry.__all__

[‘MeshBuffers’, ‘MeshRegistry’]

class simvx.graphics.renderer.mesh_registry.MeshBuffers

Bases: typing.NamedTuple

The GPU buffers of one registered mesh, per vertex stream.

extras / skin are None when the mesh has no such stream. Fields order-match the Vulkan binding numbers (0..3) plus the index buffer.

position: Any

None

shading: Any

None

extras: Any | None

None

skin: Any | None

None

index: Any

None

class simvx.graphics.renderer.mesh_registry.MeshRegistry(device: Any, physical_device: Any, *, retain_geometry: bool = False)

Upload meshes to GPU, return handles for efficient referencing.

Initialization

register(streams: simvx.graphics.types.VertexStreams, indices: numpy.ndarray) simvx.graphics.types.MeshHandle

Upload the mesh’s vertex streams + indices to GPU, return a handle.

get_buffers(handle: simvx.graphics.types.MeshHandle) simvx.graphics.renderer.mesh_registry.MeshBuffers

Get the per-stream :class:MeshBuffers for a mesh handle.

get_geometry(mesh_id: int) tuple[simvx.graphics.types.VertexStreams, numpy.ndarray] | None

Return the retained source (streams, indices) for a mesh id, or None.

Only populated when the registry was created with retain_geometry=True (the multi-device path). None on the default single-device path (nothing is retained) and for any mesh id never registered. The arrays are the same device-independent CPU data the primary uploaded; the offload coordinator re-uploads them into a secondary device’s own MeshRegistry to make the offloaded SRU’s geometry resident there (a VkBuffer cannot cross devices).

destroy() None

Free all mesh buffers.