pub struct GpuComputeLayoutEngine { /* private fields */ }Expand description
Persistent GPU compute layout and zero-readback indirect draw engine supporting Apple Metal hardware and bit-exact CPU parity.
Implementations§
Source§impl GpuComputeLayoutEngine
Hardware initialization, persistent buffer management, and compute layout dispatch for GpuComputeLayoutEngine.
impl GpuComputeLayoutEngine
Hardware initialization, persistent buffer management, and compute layout dispatch for GpuComputeLayoutEngine.
Sourcepub fn probe() -> Self
pub fn probe() -> Self
Probes physical Apple Metal compute pipelines when available, falling back cleanly to CPU reference parity.
§Returns
Self- Ready compute layout engine.
Sourcepub fn cpu_reference_only() -> Self
pub fn cpu_reference_only() -> Self
Creates a deterministic CPU reference compute parity engine that never invokes hardware GPU APIs.
§Returns
Self- CPU reference parity compute engine.
Sourcepub fn is_hardware_compute_ready(&self) -> bool
pub fn is_hardware_compute_ready(&self) -> bool
Returns true when physical GPU compute pipelines are compiled and ready for dispatch.
§Returns
bool-truewhen executing on physical hardware compute pipelines.
Sourcepub fn dispatch(
&mut self,
scene: &GpuComputeSceneInput,
render_offscreen: bool,
) -> GpuComputeDispatchResult
pub fn dispatch( &mut self, scene: &GpuComputeSceneInput, render_offscreen: bool, ) -> GpuComputeDispatchResult
Executes the 4-kernel GPU compute layout pipeline and optionally renders compacted primitives via indirect draw into an offscreen target.
§Arguments
&GpuComputeSceneInput- Flat BFS layout inputs, styles, and level offsets.bool- Whentrue, also executes hardwaredrawPrimitives:indirectBuffer:into an offscreenMTLTexture.
§Returns
GpuComputeDispatchResult- Resolved layout outputs, compacted primitives, indirect draw args, hit-test result, and GPU timing telemetry.
Sourcepub fn dispatch_steady_indirect(
&mut self,
scene: &GpuComputeSceneInput,
render_offscreen: bool,
upload_buffers: bool,
) -> GpuComputeDispatchResult
pub fn dispatch_steady_indirect( &mut self, scene: &GpuComputeSceneInput, render_offscreen: bool, upload_buffers: bool, ) -> GpuComputeDispatchResult
Executes the steady-state zero-readback GPU compute layout and indirect render pipeline without copying outputs, primitives, or offscreen pixels back to CPU memory.
§Arguments
&GpuComputeSceneInput- Flat BFS scene descriptors (only root and uniform update whenupload_buffersisfalse).bool- Whentrue, encodes hardwaredrawPrimitives:indirectBuffer:into the offscreenMTLTexture.bool- Whentrue, uploads full node and visual buffers; whenfalse, reuses resident GPU buffers and updates only root + uniforms.
§Returns
GpuComputeDispatchResult- Hardware GPU timing, draw count, and indirect args with zero CPU readback allocations.
Sourcepub fn begin_steady_indirect_async(
&mut self,
scene: &GpuComputeSceneInput,
render_offscreen: bool,
upload_buffers: bool,
) -> Option<(usize, usize, usize)>
pub fn begin_steady_indirect_async( &mut self, scene: &GpuComputeSceneInput, render_offscreen: bool, upload_buffers: bool, ) -> Option<(usize, usize, usize)>
Commits a zero-readback GPU compute layout and optional indirect render command buffer asynchronously so CPU worker threads can overlap concurrently (MixedCoExec).
§Arguments
&GpuComputeSceneInput- Flat BFS scene descriptors.bool- Whentrue, also encodes hardwaredrawPrimitives:indirectBuffer:into the offscreenMTLTexture.bool- Whentrue, uploads full node and visual buffers; whenfalse, reuses resident GPU memory.
§Returns
Option<(usize, usize, usize)>- Retained in-flight command buffer tuple(cmd_buf_handle, draw_calls, uploaded_bytes)when submitted on hardware GPU, orNoneon CPU fallback.
Sourcepub fn finish_steady_indirect_async(
&mut self,
in_flight: (usize, usize, usize),
) -> GpuComputeDispatchResult
pub fn finish_steady_indirect_async( &mut self, in_flight: (usize, usize, usize), ) -> GpuComputeDispatchResult
Awaits completion of a command buffer previously committed by begin_steady_indirect_async and returns exact hardware GPU execution telemetry.
§Arguments
(usize, usize, usize)- In-flight tuple(cmd_buf_handle, draw_calls, uploaded_bytes)returned bybegin_steady_indirect_async.
§Returns
GpuComputeDispatchResult- Hardware GPU execution duration, draw calls, and indirect draw arguments.
Sourcepub fn upload_primitive_spans_metal(
&mut self,
primitives: &[GpuPrimitiveInstance],
spans: &[DirtyBufferSpan],
slot: usize,
wait_sync: bool,
) -> Option<(usize, u64)>
pub fn upload_primitive_spans_metal( &mut self, primitives: &[GpuPrimitiveInstance], spans: &[DirtyBufferSpan], slot: usize, wait_sync: bool, ) -> Option<(usize, u64)>
Uploads coalesced DirtyBufferSpan byte ranges from primitives into a GPU-private MTLBuffer via a real Metal MTLBlitCommandEncoder, supporting both in_flight = 1 synchronous and in_flight = 2 ping-pong asynchronous pipelining.
§Arguments
&[GpuPrimitiveInstance]- Source frame primitive array (64bytes per entry).&[DirtyBufferSpan]- Coalesced dirty byte ranges produced byDirtySpanCoalescer.usize- Ping-pong staging slot index (0or1).bool- Whentrue, blocks onwaitUntilCompleted(in_flight = 1); whenfalse, returns the retained command buffer forfinish_upload_metal(in_flight = 2).
§Returns
Option<(usize, u64)>- Tuple(retained_cmd_buf_or_zero, gpu_exec_ns)on hardware Metal, orNoneon CPU fallback.
Sourcepub fn finish_upload_metal(&self, cmd_handle: usize) -> u64
pub fn finish_upload_metal(&self, cmd_handle: usize) -> u64
Source§impl GpuComputeLayoutEngine
impl GpuComputeLayoutEngine
pub fn get_backend_kind(&self) -> GpuComputeBackendKind
pub fn get_device_handle(&self) -> usize
pub fn get_queue_handle(&self) -> usize
pub fn get_input_buffer_handle(&self) -> usize
pub fn get_input_contents_ptr(&self) -> usize
pub fn get_output_buffer_handle(&self) -> usize
pub fn get_output_contents_ptr(&self) -> usize
pub fn get_visual_buffer_handle(&self) -> usize
pub fn get_visual_contents_ptr(&self) -> usize
pub fn get_primitive_buffer_handle(&self) -> usize
pub fn get_primitive_contents_ptr(&self) -> usize
pub fn get_indirect_buffer_handle(&self) -> usize
pub fn get_indirect_contents_ptr(&self) -> usize
pub fn get_hit_buffer_handle(&self) -> usize
pub fn get_hit_contents_ptr(&self) -> usize
pub fn get_allocated_node_capacity(&self) -> usize
pub fn get_offscreen_texture_handle(&self) -> usize
pub fn get_offscreen_width(&self) -> u32
pub fn get_offscreen_height(&self) -> u32
pub fn get_total_dispatches(&self) -> u64
pub fn get_cached_uniform_row_h(&self) -> f32
pub fn get_upload_staging_handles(&self) -> [usize; 2]
pub fn get_upload_staging_ptrs(&self) -> [usize; 2]
pub fn get_upload_private_handle(&self) -> usize
pub fn get_upload_capacity_bytes(&self) -> usize
Trait Implementations§
Source§impl Debug for GpuComputeLayoutEngine
impl Debug for GpuComputeLayoutEngine
Source§impl Default for GpuComputeLayoutEngine
Default initialization probing native hardware compute support with automatic CPU reference parity fallback.
impl Default for GpuComputeLayoutEngine
Default initialization probing native hardware compute support with automatic CPU reference parity fallback.