Skip to main content

Module double_buffer

Module double_buffer 

Source
Expand description

Double-buffered GPU command submission.

Overlaps CPU work (encoding the next frame’s commands) with GPU work (executing the current frame’s commands) using a ping-pong buffer scheme.

§Architecture

Frame N:   CPU encodes buffer A   ───▶  GPU executes buffer A
Frame N+1: CPU encodes buffer B   ───▶  GPU executes buffer B
Frame N+2: CPU encodes buffer A   ───▶  GPU executes buffer A  (recycled)
           └──── overlapped ─────┘

The DoubleBufferSubmitter manages two command slots and alternates between them. While the GPU processes slot A, the CPU can prepare commands in slot B, minimising idle time on both sides.

§Status

This module provides the scheduling and statistics logic. Actual GPU command execution is delegated to the caller via closures.

Structs§

CommandSlot
A command buffer slot with timing information.
DoubleBufferStats
Performance statistics for the double-buffer submitter.
DoubleBufferSubmitter
Double-buffered command submission manager.

Enums§

DoubleBufferError
Errors from the double-buffer submitter.
SlotState
State of a single command buffer slot.