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

donner::gpu::browser::BrowserBridge - the boundary between the runtime and the browser's GPU service. More...

#include <array>
#include <cstdint>
#include <memory>
#include <span>
#include <string_view>
#include <vector>
#include "donner/base/RcString.h"
#include "donner/gpu/Descriptors.h"
#include "donner/gpu/TextureExport.h"
#include "donner/gpu/browser/BrowserObjectTable.h"
Include dependency graph for BrowserBridge.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::gpu::browser::BrowserBindGroupLayoutEntry
 One entry of a bind group layout, with its enumerated values already encoded. More...
struct  donner::gpu::browser::BrowserBindGroupEntry
 One entry of a bind group, naming the bound object by identifier. More...
struct  donner::gpu::browser::BrowserVertexAttribute
 One vertex attribute of a render pipeline, with its format already encoded. More...
struct  donner::gpu::browser::BrowserVertexBufferLayout
 One vertex buffer slot of a render pipeline. More...
struct  donner::gpu::browser::BrowserBlendComponent
 One blend term of a color target, with its factors and operation already encoded. More...
struct  donner::gpu::browser::BrowserColorTarget
 One color target of a render pipeline. More...
struct  donner::gpu::browser::BrowserRenderPipelineRequest
 A render pipeline, with every referenced object named by identifier. More...
struct  donner::gpu::browser::BrowserComputePipelineRequest
 A compute pipeline, with every referenced object named by identifier. More...
struct  donner::gpu::browser::BrowserColorAttachment
 One color attachment of a render pass, naming its view by identifier. More...
struct  donner::gpu::browser::BrowserCopyRegion
 A rectangular region of texels, for the copy operations. More...
struct  donner::gpu::browser::BrowserTexelLayout
 The byte layout of texel rows in a copy, already flattened to scalars. More...
struct  donner::gpu::browser::BrowserSurfaceCapabilities
 What a browser surface reports it supports. More...
class  donner::gpu::browser::BrowserSharedTexture
 A texture one logical device has shared with the others over the same browser device. More...
class  donner::gpu::browser::BrowserBridge
 The browser's GPU service, as the runtime uses it. More...

Namespaces

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

Typedefs

using donner::gpu::browser::BrowserTextureShareId = uint32_t
 Identifier of a texture one logical device holds for the others over the same browser device. The browser side draws these from a space it never reuses.

Enumerations

enum class  donner::gpu::browser::BridgeStatus : uint8_t {
  Success ,
  UnknownObject ,
  WrongObjectKind ,
  NotOwner ,
  DeviceLost ,
  Failed
}
 What the browser side reports for one bridge call. More...
enum class  donner::gpu::browser::BrowserDeviceRequestState : uint8_t {
  Pending ,
  Ready ,
  Unavailable ,
  Failed
}
 Progress of an asynchronous request for a browser GPU device. More...
enum class  donner::gpu::browser::BrowserBindingResource : uint8_t {
  Buffer ,
  TextureView ,
  Sampler
}
 Which kind of resource a donner::gpu::browser::BrowserBindGroupEntry binds. More...

Functions

std::ostream & donner::gpu::browser::operator<< (std::ostream &os, BridgeStatus value)
 Ostream output operator.
std::ostream & donner::gpu::browser::operator<< (std::ostream &os, BrowserDeviceRequestState value)
 Ostream output operator.
std::ostream & donner::gpu::browser::operator<< (std::ostream &os, BrowserBindingResource value)
 Ostream output operator.

Detailed Description

donner::gpu::browser::BrowserBridge - the boundary between the runtime and the browser's GPU service.

Everything below the runtime's validation and above the browser's own API passes through this interface. It is deliberately narrow and flat: objects are named by donner::gpu::browser::BrowserObjectId, every enumerated value arrives as a BrowserWireCodes.h code, and every payload is a span of bytes the browser side copies out. Nothing that could name host memory - a pointer, a native handle, a callback address - crosses it.

Recorded commands are replayed one call at a time rather than handed over as an encoded stream. That keeps the browser side free of a decoder: every operation it performs is one it was called for, with arguments the runtime already validated, so there is no length, opcode or arity arithmetic on the far side to get wrong.

The interface is abstract so the runtime's behavior can be tested without a browser. The production implementation calls the browser; the test implementation records what it was asked to do.

Enumeration Type Documentation

◆ BridgeStatus

enum class donner::gpu::browser::BridgeStatus : uint8_t
strong

What the browser side reports for one bridge call.

The refusals are separated because they mean different things about what went wrong. An identifier the browser side has never heard of, one that names a live object of another kind, and a call from a context that does not own the device are three distinct failures of the caller; a lost device and a browser-side rejection are failures of the environment.

Enumerator
Success 

The browser side performed the operation.

UnknownObject 

An identifier named no live browser object.

WrongObjectKind 

An identifier named a live object of a different kind.

NotOwner 

The calling context does not own the browser device.

DeviceLost 

The device was lost, so the operation can never be performed.

Failed 

The browser rejected the operation.

◆ BrowserBindingResource

enum class donner::gpu::browser::BrowserBindingResource : uint8_t
strong

Which kind of resource a donner::gpu::browser::BrowserBindGroupEntry binds.

Enumerator
Buffer 

A range of a buffer.

TextureView 

A texture view.

Sampler 

A sampler.

◆ BrowserDeviceRequestState

Progress of an asynchronous request for a browser GPU device.

A browser hands over a device through promises, so the request has a lifetime of its own rather than being an outcome the constructor can report. The two failures are separated because they call for different responses: a browser with no GPU service at all is donner::gpu::browser::BrowserDeviceRequestState::Unavailable and the caller falls back, while a service that refused this request is donner::gpu::browser::BrowserDeviceRequestState::Failed and the reason says why.

Enumerator
Pending 

The browser has not settled the request yet.

Ready 

A device is available.

Unavailable 

The browser exposes no GPU service.

Failed 

The browser refused to supply a device.

Function Documentation

◆ operator<<() [1/3]

std::ostream & donner::gpu::browser::operator<< ( std::ostream & os,
BridgeStatus value )

Ostream output operator.

Parameters
osOutput stream.
valueValue to output.

◆ operator<<() [2/3]

std::ostream & donner::gpu::browser::operator<< ( std::ostream & os,
BrowserBindingResource value )

Ostream output operator.

Parameters
osOutput stream.
valueValue to output.

◆ operator<<() [3/3]

std::ostream & donner::gpu::browser::operator<< ( std::ostream & os,
BrowserDeviceRequestState value )

Ostream output operator.

Parameters
osOutput stream.
valueValue to output.