Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::benchmarks::DrawCountObserver Class Referencefinal

A fixed observer avoids allocating in the measured Device::submit path. More...

#include "donner/svg/renderer/geode/benchmarks/DrawCpuWorkload.h"

Inheritance diagram for donner::geode::benchmarks::DrawCountObserver:
[legend]

Public Member Functions

void onBufferCreated () override
 A buffer allocation was created.
void onTextureCreated () override
 A texture allocation the device owns was created. A registration of a texture the device does not own is not an allocation and is not reported.
void onTextureReleased () override
 The device's ownership of a texture allocation it made ended: its backing was released through Device::destroyTextureBacking, or the texture was destroyed and the last submission using it completed and its slot was recycled.
void onBindGroupCreated () override
 A bind group was created.
void onBufferWritten (uint64_t) override
 A queue write to a buffer was accepted.
void onTextureWritten (uint64_t) override
 A queue write to a texture was accepted.
void onSubmitted (uint64_t commandBufferCount, uint64_t drawCount) override
 Work reached the backend's queue as one submission.
Public Member Functions inherited from donner::gpu::DeviceObserver
virtual ~DeviceObserver ()=default
 Destructor.

Public Attributes

uint64_t submissions = 0
 Observed single-command-buffer submissions.
uint64_t lastDraws = 0
 Draw count in the last such submission.

Additional Inherited Members

Protected Member Functions inherited from donner::gpu::DeviceObserver
 DeviceObserver ()=default
 Constructible only as a base.
 DeviceObserver (const DeviceObserver &)=default
 Copyable only by a derived observer, so an observer is never sliced through its base.
DeviceObserver & operator= (const DeviceObserver &)=default
 Assignable only by a derived observer.

Detailed Description

A fixed observer avoids allocating in the measured Device::submit path.

Member Function Documentation

◆ onBindGroupCreated()

void donner::geode::benchmarks::DrawCountObserver::onBindGroupCreated ( )
inlineoverridevirtual

A bind group was created.

Implements donner::gpu::DeviceObserver.

◆ onBufferCreated()

void donner::geode::benchmarks::DrawCountObserver::onBufferCreated ( )
inlineoverridevirtual

A buffer allocation was created.

Implements donner::gpu::DeviceObserver.

◆ onBufferWritten()

void donner::geode::benchmarks::DrawCountObserver::onBufferWritten ( uint64_t byteCount)
inlineoverridevirtual

A queue write to a buffer was accepted.

Parameters
byteCountBytes written.

Implements donner::gpu::DeviceObserver.

◆ onSubmitted()

void donner::geode::benchmarks::DrawCountObserver::onSubmitted ( uint64_t commandBufferCount,
uint64_t drawCount )
inlineoverridevirtual

Work reached the backend's queue as one submission.

Parameters
commandBufferCountCommand buffers the submission carried. Zero for a submission a backend made on its own, outside Device::submit, to make the queue progress.
drawCountDraws counted under one rule on every backend: each draw command, including one with no vertices or no instances, and each indexed draw command that is not empty (see IsEmptyIndexedDraw), whether or not the backend issues it natively.

Implements donner::gpu::DeviceObserver.

◆ onTextureCreated()

void donner::geode::benchmarks::DrawCountObserver::onTextureCreated ( )
inlineoverridevirtual

A texture allocation the device owns was created. A registration of a texture the device does not own is not an allocation and is not reported.

Implements donner::gpu::DeviceObserver.

◆ onTextureReleased()

void donner::geode::benchmarks::DrawCountObserver::onTextureReleased ( )
inlineoverridevirtual

The device's ownership of a texture allocation it made ended: its backing was released through Device::destroyTextureBacking, or the texture was destroyed and the last submission using it completed and its slot was recycled.

Reported at most once per owned allocation, on the thread using the device, to the observer installed at that moment. That includes an allocation made before this observer was installed, whose creation it never heard, so an observer installed late can count more releases than creations. An allocation still owned when the device is destroyed, and one whose retired slot is never recycled, are not reported. Releasing a registration of a texture the device does not own ends no ownership and is not reported.

The allocation itself may outlive the report: an export of the texture keeps it alive until its last holder lets go, and Device::sharedTextureTailBytes counts those bytes meanwhile. Nothing is reported when that holder finally releases it. A destroyed texture a holder still reads enters that gauge when it is retired but is reported here only when its slot is recycled, so while its last submission is in flight both count it.

Implements donner::gpu::DeviceObserver.

◆ onTextureWritten()

void donner::geode::benchmarks::DrawCountObserver::onTextureWritten ( uint64_t byteCount)
inlineoverridevirtual

A queue write to a texture was accepted.

Parameters
byteCountBytes the backend handed its queue for the write: the caller's span, or the repacked rows on a backend that repacks them first, so this can differ between backends.

Implements donner::gpu::DeviceObserver.


The documentation for this class was generated from the following file: