Command Buffers, Sub-Cycles & Event Bridges
TUIX v0.6 incorporates low-level batching and sub-cycle execution engines designed for high-performance multithreaded rendering, IPC bridging, and fine-grained isolated widget animations.
Command Buffer & Atomic Frame Commits
The command buffer subsystem (`tuix.core.command_buffer`) allows mutations to be serialized into binary opcode streams. Background worker threads can enqueue command sequences without locking the rendering thread for each individual property update. Mutations are committed atomically at frame boundaries via `tuix_batch_global_commit()`.
Sub-Cycle Animation Loops (tuix.core.sub_cycles)
Sub-cycles allow high-frequency visual updates (such as spinners, progress meters, or audio visualizers) to execute partial render cycles for a single widget UID without triggering expensive full-scene graph traversals or full layout recalculations.
| Subsystem | Key Function | Purpose |
|---|---|---|
| Command Buffer | command_buffer.tuix_command_buffer_execute(data) | Executes raw opcode streams directly in C runtime. |
| Batch Commits | command_buffer.tuix_batch_global_commit() | Applies all enqueued batch operations in a single atomic step. |
| Sub-Cycle Registration | sub_cycles.tuix_sub_cycle_init(scene, obj) | Registers an isolated sub-cycle loop with transactional OOM safety. |
| Event Queue Shim | event.tuix_event_commit_python() | Flushes native C event queues into registered Python callbacks safely. |
from tuix.core import command_buffer, event, sub_cycles
# Enqueue operations in background, then commit atomically
command_buffer.tuix_batch_global_commit()
# Dispatch pending native events into Python callbacks
event.tuix_event_commit_python()