Dispatches browser GPU primitives to the editor's canvas-owning application thread. More...
#include <array>#include <cstddef>#include <cstdint>#include <type_traits>Classes | |
| struct | donner::gpu::browser::BrowserGpuOwnerDispatchTotals |
| Running totals of cross-thread owner dispatches from every client thread. Owner-local calls are excluded. Each field wraps or saturates as the matching __donnerReadGpuOwnerWaitStats field. More... | |
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. | |
| void | donner::gpu::browser::ProcessBrowserGpuOwnerBeforeFrame () |
| Service pending GPU owner requests before the next canvas frame acquires its surface. Only a bounded callback prefix runs before the frame. The existing pulse handles the rest. | |
| 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. | |
| BrowserGpuOwnerDispatchTotals | donner::gpu::browser::ReadBrowserGpuOwnerDispatchTotals () |
| Read the dispatch totals without synchronizing with dispatches in flight. All zero without a registered owner and outside pthread builds. | |
Variables | |
| constexpr std::size_t | donner::gpu::browser::kBrowserGpuOperationKindCount |
| Number of BrowserGpuOperationKind values; per-kind totals are indexed by the enum value. | |
| constexpr std::array< std::uint32_t, 7 > | donner::gpu::browser::kBrowserGpuOwnerStartLatencyBucketUpperUs |
| Inclusive upper bounds, in microseconds, of the request-to-start latency buckets of BrowserGpuOwnerDispatchTotals; a last bucket holds every longer latency. | |
Dispatches browser GPU primitives to the editor's canvas-owning application thread.
| 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.
| bytes | Borrowed payload size before dispatch. |
| void donner::gpu::browser::RunOnBrowserGpuOwner | ( | Function && | operation, |
| BrowserGpuOperationKind | kind = BrowserGpuOperationKind::Other ) |
Invoke a stack-owned callback without allocating a type-erased function.
| operation | Nonblocking browser primitive or prepared bounded command batch. |
| kind | Diagnostic category; it does not affect dispatch. |
| 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.
| operation | Callback that must not allocate, lock, yield, or call arbitrary C++ code. |
| context | Caller-owned data, valid until the operation completes. |
| kind | Diagnostic 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. |
| 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.
| active | True on frame entry, false on exit; called only by the owner, without nesting. |
|
inlineconstexpr |
Number of BrowserGpuOperationKind values; per-kind totals are indexed by the enum value.
|
inlineconstexpr |
Inclusive upper bounds, in microseconds, of the request-to-start latency buckets of BrowserGpuOwnerDispatchTotals; a last bucket holds every longer latency.