simvx.graphics.renderer.secondary_sru

Secondary-device SubViewport SRU recorder (D8 multi-GPU 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-GPU path must stay byte-identical).

class:

SecondarySRURenderer wraps a Renderer already constructed + setup on a secondary device (via a :class:~..gpu.secondary_engine.SecondaryRenderContext facade). It exposes one method, :meth:render_sru_offscreen, mirroring the primary

meth:

~..scene_adapter.SceneAdapter.render_sru_from_plan slice 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).

Honest scope. This is rig-only: it runs on the 4x Arc Pro B70 rig, never on a single-GPU box (no facade / secondary device is ever constructed there, so the offload coordinator that would call this is never built). The code is import-safe and structurally complete; 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

SecondarySRURenderer

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)[source]

Records one offloaded SubViewport SRU on a secondary device.

Constructed by the rig-side secondary_renderer_factory with the secondary

Class:

~..gpu.secondary_engine.SecondaryRenderContext facade and a Renderer(facade) already set up on that device. The offload coordinator calls :meth:render_sru_offscreen once per offloaded SRU per frame.

Initialization

set_residency(residency: Any) None[source]

Bind the :class:~..gpu.secondary_engine.SecondaryResidency for 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.MeshHandle for 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[source]

Record + submit one SRU’s draws into target on the secondary device.

Mirrors the primary :meth:SceneAdapter.render_sru_from_plan slice model on the secondary renderer:

  1. begin_frame the secondary renderer (clears its per-frame lists + resets its indirect batches; this device records its OWN frame).

  2. Remap each instance’s primary :class:MeshHandle to 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).

  3. 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).

  4. Allocate a one-shot command buffer on the secondary command pool, begin the offscreen pass on target, render_scene_content (hdr_output 0 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 in SHADER_READ_ONLY_OPTIMAL, ready for the cross-device transfer’s TRANSFER_SRC barrier.

set_materials(materials: Any) None[source]

Mirror the primary material SSBO contents onto the secondary renderer.

set_lights(lights: Any) None[source]

Mirror the primary light SSBO contents onto the secondary renderer.