simvx.graphics.renderer.secondary_sru¶
Secondary-device SubViewport SRU recorder for multi-device offload.
The cross-device offload coordinator (:class:~..gpu.multi_device.SRUOffloadCoordinator)
renders an offloaded SubViewport SRU on a secondary GPU and then transfers its
colour image to the primary for compositing. The per-device GPU recording is
delegated to this object so the shared :class:~.forward.Renderer is NOT made to
grow a multi-device entry point (the single-device path must stay unchanged).
- class:
SecondarySRURendererwraps aRendereralready constructed +setupon a secondary device (via a :class:~..gpu.secondary_engine.SecondaryRenderContextfacade). It exposes one method, :meth:render_sru_offscreen, mirroring the primary- meth:
~..scene_adapter.SceneAdapter.render_sru_from_planslice model but recording into an OWN one-shot command buffer on the secondary device and submitting on the secondary graphics queue (a secondary never shares the primary’s frame command buffer; its render must complete + signal before the cross-device transfer reads the colour image).
Scope. This runs only on a system exposing two or more Vulkan devices, never on
a single-device run (no facade / secondary device is constructed there, so the
offload coordinator that would call this is never built), and it is not exercised
by the test suite. The residency substitution it depends on (a secondary
MeshHandle per primary mesh) is flagged where the primary CPU geometry must be
supplied (see :meth:render_sru_offscreen).
Module Contents¶
Classes¶
Records one offloaded SubViewport SRU on a secondary device. |
Data¶
API¶
- simvx.graphics.renderer.secondary_sru.log¶
‘getLogger(…)’
- simvx.graphics.renderer.secondary_sru.__all__¶
[‘SecondarySRURenderer’]
- class simvx.graphics.renderer.secondary_sru.SecondarySRURenderer(facade: Any, renderer: Any)¶
Records one offloaded SubViewport SRU on a secondary device.
Constructed by the
secondary_renderer_factorywith the secondary- Class:
~..gpu.secondary_engine.SecondaryRenderContextfacade and aRenderer(facade)already set up on that device. The offload coordinator calls :meth:render_sru_offscreenonce per offloaded SRU per frame.
Initialization
- set_residency(residency: Any) None¶
Bind the :class:
~..gpu.secondary_engine.SecondaryResidencyfor handle remap.The coordinator owns residency (it mirrors meshes/textures before calling this); binding it here lets the recorder substitute each instance’s primary
- Class:
~..types.MeshHandlefor the secondary one. Optional: when unset the recorder assumes the SRU’s handles are already secondary-resident.
- render_sru_offscreen(sru: Any, target: Any) None¶
Record + submit one SRU’s draws into
targeton the secondary device.Mirrors the primary :meth:
SceneAdapter.render_sru_from_planslice model on the secondary renderer:begin_framethe secondary renderer (clears its per-frame lists + resets its indirect batches; this device records its OWN frame).Remap each instance’s primary :class:
MeshHandleto the secondary one via the bound residency (geometry was mirrored by the coordinator). FLAGGED: requires the secondary mesh to be resident; an instance whose mesh is not resident is skipped with a warning (it would index the wrong device’s buffers otherwise).Install the SRU’s single camera viewport, reserve a transform-SSBO slice, upload the SRU transforms into it, and set materials/lights mirrored from the primary (set by the coordinator via :meth:
set_materials).Allocate a one-shot command buffer on the secondary command pool, begin the offscreen pass on
target,render_scene_content(hdr_output0 so the offscreen image holds LDR), end the pass, overlay any Draw2D ops, then submit on the secondary graphics queue and wait. The RenderTarget leaves the colour image inSHADER_READ_ONLY_OPTIMAL, ready for the cross-device transfer’sTRANSFER_SRCbarrier.
- set_materials(materials: Any) None¶
Mirror the primary material SSBO contents onto the secondary renderer.
- set_lights(lights: Any) None¶
Mirror the primary light SSBO contents onto the secondary renderer.