Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
BrowserGpuOwner.h File Reference

Dispatches browser GPU primitives to the editor's canvas-owning application thread. More...

#include <cstddef>
#include <type_traits>
Include dependency graph for BrowserGpuOwner.h:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::gpu::browser::BrowserGpuOperationKind {
  Other ,
  OwnershipQuery ,
  DeviceLossQuery ,
  CompletionQuery ,
  ResourceCreation ,
  ResourceDestruction ,
  BufferWrite ,
  TextureWrite ,
  ResourceSharing ,
  CommandBatch ,
  QueueSubmit ,
  BindGroupConstruction ,
  PipelineConstruction
}
 Cross-thread dispatch categories, not object/command counts; owner-local calls are excluded. BindGroupConstruction counts whole descriptors; PipelineConstruction counts begin/entry/finish calls. CommandBatch counts batches. OwnershipQuery includes the combined ownership/loss query.

Functions

void donner::gpu::browser::RecordBrowserBufferWriteSize (std::size_t bytes)
 Record an attempted cross-owner buffer-write size without reading payloads or resource ids. Owner-local calls are excluded.
void donner::gpu::browser::RegisterBrowserGpuOwner ()
 Register the calling application thread before creating any browser GPU devices or workers.
void donner::gpu::browser::RunOnBrowserGpuOwner (void(*operation)(void *), void *context, BrowserGpuOperationKind kind=BrowserGpuOperationKind::Other)
 Execute bounded browser work synchronously on the registered owner.
template<typename Function>
void donner::gpu::browser::RunOnBrowserGpuOwner (Function &&operation, BrowserGpuOperationKind kind=BrowserGpuOperationKind::Other)
 Invoke a stack-owned callback without allocating a type-erased function.
bool donner::gpu::browser::IsBrowserGpuOwnerThread ()
 Whether the calling thread is the registered browser GPU owner.
void donner::gpu::browser::ProcessBrowserGpuOwnerWait ()
 Process one bounded batch of GPU commands while the owner is in a runtime wait. The editor's futex adapter calls this between finite wait slices; it does not run JS promises.
bool donner::gpu::browser::IsBrowserGpuOwnerDispatchActive ()
 Whether this owner is already executing a GPU batch; nested editor frames must defer.
void donner::gpu::browser::SetBrowserGpuOwnerCanvasFrameActive (bool active)
 Defer asynchronous command batches across canvas acquisition, drawing and retirement. Idle and pre-acquisition waits may service GPU work; futex dependency progress is also allowed.
void donner::gpu::browser::StopBrowserGpuOwner ()
 Stop delivery on the owner after every client has joined and released its resources. This is terminal: later GPU calls fail closed instead of reverting to standalone dispatch.
bool donner::gpu::browser::UsesBrowserGpuOwner ()
 Whether this module has registered a shared browser GPU owner.

Detailed Description

Dispatches browser GPU primitives to the editor's canvas-owning application thread.

Function Documentation

◆ RecordBrowserBufferWriteSize()

void donner::gpu::browser::RecordBrowserBufferWriteSize ( std::size_t bytes)

Record an attempted cross-owner buffer-write size without reading payloads or resource ids. Owner-local calls are excluded.

Parameters
bytesBorrowed payload size before dispatch.

◆ RunOnBrowserGpuOwner() [1/2]

template<typename Function>
void donner::gpu::browser::RunOnBrowserGpuOwner ( Function && operation,
BrowserGpuOperationKind kind = BrowserGpuOperationKind::Other )

Invoke a stack-owned callback without allocating a type-erased function.

Parameters
operationNonblocking browser primitive or prepared bounded command batch.
kindDiagnostic category; it does not affect dispatch.

◆ RunOnBrowserGpuOwner() [2/2]

void donner::gpu::browser::RunOnBrowserGpuOwner ( void(* operation )(void *),
void * context,
BrowserGpuOperationKind kind = BrowserGpuOperationKind::Other )

Execute bounded browser work synchronously on the registered owner.

Without a registered owner, standalone modules execute on the calling thread.

Parameters
operationCallback that must not allocate, lock, yield, or call arbitrary C++ code.
contextCaller-owned data, valid until the operation completes.
kindDiagnostic category; it does not affect dispatch. Inline notification work stops starting callbacks after 32 calls or 2 ms of callback CPU; a later owner pulse renews that budget. A running callback is not preempted. A failed dispatch or expired deadline terminates the module rather than leaving borrowed data reachable by a delayed callback. The owner remains alive until all clients are destroyed.

◆ SetBrowserGpuOwnerCanvasFrameActive()

void donner::gpu::browser::SetBrowserGpuOwnerCanvasFrameActive ( bool active)

Defer asynchronous command batches across canvas acquisition, drawing and retirement. Idle and pre-acquisition waits may service GPU work; futex dependency progress is also allowed.

Parameters
activeTrue on frame entry, false on exit; called only by the owner, without nesting.