Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::gpu::browser::BrowserBridge Class Referenceabstract

The browser's GPU service, as the runtime uses it. More...

#include "donner/gpu/browser/BrowserBridge.h"

Inheritance diagram for donner::gpu::browser::BrowserBridge:
[legend]

Public Member Functions

virtual ~BrowserBridge ()
 Destructor; releases this logical device's state on the browser side. The browser device itself goes once no logical device over it is left.
 BrowserBridge (const BrowserBridge &)=delete
BrowserBridge & operator= (const BrowserBridge &)=delete
 BrowserBridge (BrowserBridge &&)=delete
BrowserBridge & operator= (BrowserBridge &&)=delete
virtual BridgeStatus beginDeviceRequest ()=0
 Asks for this logical device's browser GPU device. The first logical device in a worker to ask begins the browser's request, which settles asynchronously; every later one joins the device that request obtains.
virtual BrowserDeviceRequestState deviceRequestState () const =0
 How far the request begun by beginDeviceRequest has progressed.
virtual RcString deviceRequestError () const =0
 Why the request failed, when deviceRequestState reports a failure. Empty otherwise.
virtual BridgeStatus deviceStatus () const =0
 Checks current ownership and loss together. Returns Success for an owned, live device, NotOwner for a missing device or foreign context, or DeviceLost for an owned, lost device. Other statuses indicate a failed query. Implementations must not cache this state.
virtual bool isDeviceLost () const =0
 Whether the browser has reported the device lost. Once true it never becomes false again.
virtual RcString deviceLostReason () const =0
 What the browser said when it reported the device lost. Empty while the device is alive.
virtual uint64_t completedSerial () const =0
 Serial of this logical device's most recent submission the browser has reported finished (0 if none). Each logical device numbers its submissions on its own.
virtual uint32_t maxTextureDimension2D () const =0
 Largest width or height of a 2D texture the browser device supports, as its limits report it, or 0 when this logical device holds no device or the browser reports no such limit.
virtual const void * sharedDeviceIdentity () const =0
 Identity of the browser device this logical device runs on: the same for every bridge over that device and different for every other, including a device obtained after this one was released.
virtual BridgeStatus shareTexture (BrowserObjectId textureId, std::shared_ptr< const BrowserSharedTexture > &shared)=0
 Holds the texture textureId for the other logical devices over the same browser device.
virtual BridgeStatus registerSharedTexture (BrowserObjectId id, const BrowserSharedTexture &shared)=0
 Registers the texture shared names under id, as a read-only alias in this logical device.
virtual BridgeStatus createBuffer (BrowserObjectId id, uint64_t byteSize, uint32_t usageBits)=0
 Creates a buffer.
virtual BridgeStatus createTexture (BrowserObjectId id, uint32_t width, uint32_t height, uint32_t formatCode, uint32_t usageBits)=0
 Creates a texture.
virtual BridgeStatus createTextureView (BrowserObjectId id, BrowserObjectId textureId)=0
 Creates a view covering the whole texture.
virtual BridgeStatus createSampler (BrowserObjectId id, uint32_t magFilterCode, uint32_t minFilterCode, uint32_t addressUCode, uint32_t addressVCode)=0
 Creates a sampler.
virtual BridgeStatus createBindGroupLayout (BrowserObjectId id, std::span< const BrowserBindGroupLayoutEntry > entries)=0
 Creates a bind group layout.
virtual BridgeStatus createBindGroup (BrowserObjectId id, BrowserObjectId layoutId, std::span< const BrowserBindGroupEntry > entries)=0
 Creates a bind group.
virtual BridgeStatus createPipelineLayout (BrowserObjectId id, std::span< const BrowserObjectId > groupLayoutIds)=0
 Creates a pipeline layout.
virtual BridgeStatus createShaderModule (BrowserObjectId id, std::string_view wgsl)=0
 Creates a shader module from trusted build output.
virtual BridgeStatus createRenderPipeline (BrowserObjectId id, const BrowserRenderPipelineRequest &request)=0
 Creates a render pipeline.
virtual BridgeStatus createComputePipeline (BrowserObjectId id, const BrowserComputePipelineRequest &request)=0
 Creates a compute pipeline.
virtual BridgeStatus destroyObject (BrowserObjectKind kind, BrowserObjectId id)=0
 Releases a browser object and unregisters its identifier, which is never reissued. A texture a share still holds is not destroyed until the share is released.
virtual BridgeStatus writeBuffer (BrowserObjectId bufferId, uint64_t offsetBytes, std::span< const uint8_t > data)=0
 Writes bytes into a buffer.
virtual BridgeStatus writeTexture (BrowserObjectId textureId, std::span< const uint8_t > data, const BrowserTexelLayout &layout, const BrowserCopyRegion &region)=0
 Writes texel rows into a texture.
virtual BridgeStatus beginCommandBuffer (uint64_t submissionSerial, uint32_t commandBufferIndex)=0
 Opens recording for the command buffer at commandBufferIndex of the submission with submissionSerial. Index zero starts the submission and discards whatever an earlier attempt finished without submitting, so a refused command can never end up submitted as part of a later frame; a later index must find exactly that many finished buffers under the same serial, which is how the two halves agree on what is being recorded.
virtual BridgeStatus beginRenderPass (std::span< const BrowserColorAttachment > colorAttachments)=0
 Begins a render pass.
virtual BridgeStatus endRenderPass ()=0
 Ends the open render pass.
virtual BridgeStatus beginComputePass ()=0
 Begins a compute pass.
virtual BridgeStatus endComputePass ()=0
 Ends the open compute pass.
virtual BridgeStatus setRenderPipeline (BrowserObjectId pipelineId)=0
 Sets the render pipeline of the open render pass.
virtual BridgeStatus setComputePipeline (BrowserObjectId pipelineId)=0
 Sets the compute pipeline of the open compute pass.
virtual BridgeStatus setBindGroup (uint32_t index, BrowserObjectId bindGroupId)=0
 Binds a group in the open pass.
virtual BridgeStatus setVertexBuffer (uint32_t slot, BrowserObjectId bufferId, uint64_t offsetBytes)=0
 Binds a vertex buffer.
virtual BridgeStatus setIndexBuffer (BrowserObjectId bufferId, uint32_t indexFormatCode, uint64_t offsetBytes)=0
 Binds an index buffer.
virtual BridgeStatus setScissorRect (uint32_t x, uint32_t y, uint32_t width, uint32_t height)=0
 Sets the scissor rectangle.
virtual BridgeStatus setViewport (float x, float y, float width, float height, float minDepth, float maxDepth)=0
 Sets the viewport.
virtual BridgeStatus draw (uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)=0
 Draws non-indexed geometry.
virtual BridgeStatus drawIndexed (uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance)=0
 Draws indexed geometry.
virtual BridgeStatus dispatchWorkgroups (uint32_t countX, uint32_t countY, uint32_t countZ)=0
 Dispatches compute workgroups.
virtual BridgeStatus copyTextureToBuffer (BrowserObjectId textureId, BrowserObjectId bufferId, const BrowserTexelLayout &layout, const BrowserCopyRegion &region)=0
 Copies texels into a buffer.
virtual BridgeStatus copyTextureToTexture (BrowserObjectId sourceTextureId, BrowserObjectId destinationTextureId, const BrowserCopyRegion &region)=0
 Copies texels between textures.
virtual BridgeStatus endCommandBuffer (uint64_t submissionSerial)=0
 Finishes the open command buffer and holds it for the submission, without reaching the queue: a submission of several buffers reaches the queue once, in submitCommandBuffers.
virtual BridgeStatus submitCommandBuffers (uint64_t submissionSerial)=0
 Submits every command buffer finished under submissionSerial as one queue submission, in the order they were recorded, and arranges for the reported completed serial to reach submissionSerial once that submission finishes.
virtual BridgeStatus mapBufferAsync (BrowserObjectId mappingId, BrowserObjectId bufferId, uint64_t offsetBytes, uint64_t byteCount)=0
 Begins mapping a buffer range for host reads.
virtual MapSliceState mappingState (BrowserObjectId mappingId) const =0
 State of a mapping the browser has been asked for.
virtual BridgeStatus requestMappingProgress (BrowserObjectId mappingId)=0
 Submits an empty command list while this mapping remains pending, without submitting recorded commands or changing logical submission serials.
virtual void yieldToBrowser (double seconds)=0
 Gives the browser up to seconds of this thread to make progress.
virtual BridgeStatus mappedBytes (BrowserObjectId mappingId, std::span< const uint8_t > &bytes) const =0
 Bytes of a completed mapping, valid until the mapping is released. Returns an empty span with a non-success status when the mapping is not readable.
virtual BridgeStatus unmapBuffer (BrowserObjectId mappingId)=0
 Releases a mapping and unregisters its identifier.
virtual BridgeStatus createSurface (BrowserObjectId id, std::string_view canvasSelector)=0
 Creates a surface over the canvas named by canvasSelector.
virtual BridgeStatus surfaceCapabilities (BrowserObjectId surfaceId, BrowserSurfaceCapabilities &capabilities) const =0
 Reports what a surface supports.
virtual BridgeStatus configureSurface (BrowserObjectId surfaceId, uint32_t formatCode, uint32_t usageBits, uint32_t width, uint32_t height, uint32_t alphaModeCode)=0
 Configures how a surface presents.
virtual BridgeStatus acquireCurrentTexture (BrowserObjectId surfaceId, BrowserObjectId textureId, SurfaceStatus &status)=0
 Takes the surface's texture for this frame and registers it under textureId.
virtual BridgeStatus presentSurface (BrowserObjectId surfaceId, SurfaceStatus &status)=0
 Finishes the acquired canvas frame for implicit browser presentation.
virtual BridgeStatus abandonCurrentTexture (BrowserObjectId surfaceId)=0
 Gives back the acquired texture without showing it.

Protected Member Functions

 BrowserBridge ()
 Constructor for implementations.

Detailed Description

The browser's GPU service, as the runtime uses it.

One instance stands for one logical device: the state one runtime device keeps on the browser side, which is its identifiers, its host mappings, its recording and the serial of its last finished submission. Several logical devices in one worker share that worker's one browser device and its queue, the way a renderer and the snapshot capture context beside it do, and none of them may refuse, overwrite or release another's state. Implementations perform no validation of their own beyond the identifier, kind and ownership checks each call documents: everything else arrives already validated by donner::gpu::Device.

Member Function Documentation

◆ abandonCurrentTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::abandonCurrentTexture ( BrowserObjectId surfaceId)
pure virtual

Gives back the acquired texture without showing it.

Parameters
surfaceIdSurface holding it.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ acquireCurrentTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::acquireCurrentTexture ( BrowserObjectId surfaceId,
BrowserObjectId textureId,
SurfaceStatus & status )
pure virtual

Takes the surface's texture for this frame and registers it under textureId.

Parameters
surfaceIdSurface to acquire from.
textureIdIdentifier for the frame texture.
statusReceives what the surface reported.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ beginCommandBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::beginCommandBuffer ( uint64_t submissionSerial,
uint32_t commandBufferIndex )
pure virtual

Opens recording for the command buffer at commandBufferIndex of the submission with submissionSerial. Index zero starts the submission and discards whatever an earlier attempt finished without submitting, so a refused command can never end up submitted as part of a later frame; a later index must find exactly that many finished buffers under the same serial, which is how the two halves agree on what is being recorded.

Parameters
submissionSerialSerial the runtime assigned.
commandBufferIndexPosition of this buffer within the submission.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ beginComputePass()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::beginComputePass ( )
pure virtual

Begins a compute pass.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ beginDeviceRequest()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::beginDeviceRequest ( )
pure virtual

Asks for this logical device's browser GPU device. The first logical device in a worker to ask begins the browser's request, which settles asynchronously; every later one joins the device that request obtains.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ beginRenderPass()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::beginRenderPass ( std::span< const BrowserColorAttachment > colorAttachments)
pure virtual

Begins a render pass.

Parameters
colorAttachmentsAttachments of the pass.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ completedSerial()

virtual uint64_t donner::gpu::browser::BrowserBridge::completedSerial ( ) const
pure virtual

Serial of this logical device's most recent submission the browser has reported finished (0 if none). Each logical device numbers its submissions on its own.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ configureSurface()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::configureSurface ( BrowserObjectId surfaceId,
uint32_t formatCode,
uint32_t usageBits,
uint32_t width,
uint32_t height,
uint32_t alphaModeCode )
pure virtual

Configures how a surface presents.

Parameters
surfaceIdSurface to configure.
formatCodeEncoded TextureFormat.
usageBitsEncoded TextureUsage mask.
widthWidth in texels.
heightHeight in texels.
alphaModeCodeEncoded SurfaceAlphaMode.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ copyTextureToBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::copyTextureToBuffer ( BrowserObjectId textureId,
BrowserObjectId bufferId,
const BrowserTexelLayout & layout,
const BrowserCopyRegion & region )
pure virtual

Copies texels into a buffer.

Parameters
textureIdSource texture.
bufferIdDestination buffer.
layoutDestination row layout.
regionCopied rectangle.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ copyTextureToTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::copyTextureToTexture ( BrowserObjectId sourceTextureId,
BrowserObjectId destinationTextureId,
const BrowserCopyRegion & region )
pure virtual

Copies texels between textures.

Parameters
sourceTextureIdSource.
destinationTextureIdDestination.
regionCopied rectangle with both origins.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createBindGroup()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createBindGroup ( BrowserObjectId id,
BrowserObjectId layoutId,
std::span< const BrowserBindGroupEntry > entries )
pure virtual

Creates a bind group.

Parameters
idIdentifier to register it under.
layoutIdLayout the entries match.
entriesBound resources.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createBindGroupLayout()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createBindGroupLayout ( BrowserObjectId id,
std::span< const BrowserBindGroupLayoutEntry > entries )
pure virtual

Creates a bind group layout.

Parameters
idIdentifier to register it under.
entriesLayout entries.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createBuffer ( BrowserObjectId id,
uint64_t byteSize,
uint32_t usageBits )
pure virtual

Creates a buffer.

Parameters
idIdentifier to register it under.
byteSizeSize in bytes.
usageBitsEncoded BufferUsage mask.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createComputePipeline()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createComputePipeline ( BrowserObjectId id,
const BrowserComputePipelineRequest & request )
pure virtual

Creates a compute pipeline.

Parameters
idIdentifier to register it under.
requestPipeline description.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createPipelineLayout()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createPipelineLayout ( BrowserObjectId id,
std::span< const BrowserObjectId > groupLayoutIds )
pure virtual

Creates a pipeline layout.

Parameters
idIdentifier to register it under.
groupLayoutIdsBind group layouts, by group index.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createRenderPipeline()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createRenderPipeline ( BrowserObjectId id,
const BrowserRenderPipelineRequest & request )
pure virtual

Creates a render pipeline.

Parameters
idIdentifier to register it under.
requestPipeline description.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createSampler()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createSampler ( BrowserObjectId id,
uint32_t magFilterCode,
uint32_t minFilterCode,
uint32_t addressUCode,
uint32_t addressVCode )
pure virtual

Creates a sampler.

Parameters
idIdentifier to register it under.
magFilterCodeEncoded magnification FilterMode.
minFilterCodeEncoded minification FilterMode.
addressUCodeEncoded U AddressMode.
addressVCodeEncoded V AddressMode.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createShaderModule()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createShaderModule ( BrowserObjectId id,
std::string_view wgsl )
pure virtual

Creates a shader module from trusted build output.

Parameters
idIdentifier to register it under.
wgslShader source text.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createSurface()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createSurface ( BrowserObjectId id,
std::string_view canvasSelector )
pure virtual

Creates a surface over the canvas named by canvasSelector.

Parameters
idIdentifier to register it under.
canvasSelectorCSS selector naming the canvas.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createTexture ( BrowserObjectId id,
uint32_t width,
uint32_t height,
uint32_t formatCode,
uint32_t usageBits )
pure virtual

Creates a texture.

Parameters
idIdentifier to register it under.
widthWidth in texels.
heightHeight in texels.
formatCodeEncoded TextureFormat.
usageBitsEncoded TextureUsage mask.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ createTextureView()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::createTextureView ( BrowserObjectId id,
BrowserObjectId textureId )
pure virtual

Creates a view covering the whole texture.

Parameters
idIdentifier to register it under.
textureIdTexture to view.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ destroyObject()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::destroyObject ( BrowserObjectKind kind,
BrowserObjectId id )
pure virtual

Releases a browser object and unregisters its identifier, which is never reissued. A texture a share still holds is not destroyed until the share is released.

Parameters
kindKind the identifier must name.
idIdentifier to release.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ deviceLostReason()

virtual RcString donner::gpu::browser::BrowserBridge::deviceLostReason ( ) const
pure virtual

What the browser said when it reported the device lost. Empty while the device is alive.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ deviceRequestError()

virtual RcString donner::gpu::browser::BrowserBridge::deviceRequestError ( ) const
pure virtual

Why the request failed, when deviceRequestState reports a failure. Empty otherwise.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ deviceRequestState()

virtual BrowserDeviceRequestState donner::gpu::browser::BrowserBridge::deviceRequestState ( ) const
pure virtual

How far the request begun by beginDeviceRequest has progressed.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ deviceStatus()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::deviceStatus ( ) const
pure virtual

Checks current ownership and loss together. Returns Success for an owned, live device, NotOwner for a missing device or foreign context, or DeviceLost for an owned, lost device. Other statuses indicate a failed query. Implementations must not cache this state.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ dispatchWorkgroups()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::dispatchWorkgroups ( uint32_t countX,
uint32_t countY,
uint32_t countZ )
pure virtual

Dispatches compute workgroups.

Parameters
countXWorkgroups along X.
countYWorkgroups along Y.
countZWorkgroups along Z.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ draw()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::draw ( uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance )
pure virtual

Draws non-indexed geometry.

Parameters
vertexCountVertices.
instanceCountInstances.
firstVertexFirst vertex.
firstInstanceFirst instance.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ drawIndexed()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::drawIndexed ( uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
int32_t baseVertex,
uint32_t firstInstance )
pure virtual

Draws indexed geometry.

Parameters
indexCountIndices.
instanceCountInstances.
firstIndexFirst index.
baseVertexValue added to every index.
firstInstanceFirst instance.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ endCommandBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::endCommandBuffer ( uint64_t submissionSerial)
pure virtual

Finishes the open command buffer and holds it for the submission, without reaching the queue: a submission of several buffers reaches the queue once, in submitCommandBuffers.

Parameters
submissionSerialSerial the runtime assigned.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ endComputePass()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::endComputePass ( )
pure virtual

Ends the open compute pass.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ endRenderPass()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::endRenderPass ( )
pure virtual

Ends the open render pass.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ isDeviceLost()

virtual bool donner::gpu::browser::BrowserBridge::isDeviceLost ( ) const
pure virtual

Whether the browser has reported the device lost. Once true it never becomes false again.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ mapBufferAsync()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::mapBufferAsync ( BrowserObjectId mappingId,
BrowserObjectId bufferId,
uint64_t offsetBytes,
uint64_t byteCount )
pure virtual

Begins mapping a buffer range for host reads.

Parameters
mappingIdIdentifier to register the mapping under.
bufferIdBuffer to map.
offsetBytesByte offset of the range.
byteCountLength of the range.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ mappedBytes()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::mappedBytes ( BrowserObjectId mappingId,
std::span< const uint8_t > & bytes ) const
pure virtual

Bytes of a completed mapping, valid until the mapping is released. Returns an empty span with a non-success status when the mapping is not readable.

Parameters
mappingIdMapping to read.
bytesReceives the mapped bytes on success.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ mappingState()

virtual MapSliceState donner::gpu::browser::BrowserBridge::mappingState ( BrowserObjectId mappingId) const
pure virtual

State of a mapping the browser has been asked for.

Parameters
mappingIdMapping to query.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ maxTextureDimension2D()

virtual uint32_t donner::gpu::browser::BrowserBridge::maxTextureDimension2D ( ) const
pure virtual

Largest width or height of a 2D texture the browser device supports, as its limits report it, or 0 when this logical device holds no device or the browser reports no such limit.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ presentSurface()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::presentSurface ( BrowserObjectId surfaceId,
SurfaceStatus & status )
pure virtual

Finishes the acquired canvas frame for implicit browser presentation.

Parameters
surfaceIdSurface holding the frame.
statusReceives the presentation outcome.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ registerSharedTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::registerSharedTexture ( BrowserObjectId id,
const BrowserSharedTexture & shared )
pure virtual

Registers the texture shared names under id, as a read-only alias in this logical device.

Destroying the alias releases nothing but the identifier.

Parameters
idIdentifier to register the alias under.
sharedShare another logical device over the same browser device made.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ requestMappingProgress()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::requestMappingProgress ( BrowserObjectId mappingId)
pure virtual

Submits an empty command list while this mapping remains pending, without submitting recorded commands or changing logical submission serials.

Parameters
mappingIdMapping to advance.
Returns
Success only when a queue submission was made.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setBindGroup()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setBindGroup ( uint32_t index,
BrowserObjectId bindGroupId )
pure virtual

Binds a group in the open pass.

Parameters
indexGroup index.
bindGroupIdBind group.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setComputePipeline()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setComputePipeline ( BrowserObjectId pipelineId)
pure virtual

Sets the compute pipeline of the open compute pass.

Parameters
pipelineIdCompute pipeline.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setIndexBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setIndexBuffer ( BrowserObjectId bufferId,
uint32_t indexFormatCode,
uint64_t offsetBytes )
pure virtual

Binds an index buffer.

Parameters
bufferIdBuffer.
indexFormatCodeEncoded IndexFormat.
offsetBytesByte offset of the first index.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setRenderPipeline()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setRenderPipeline ( BrowserObjectId pipelineId)
pure virtual

Sets the render pipeline of the open render pass.

Parameters
pipelineIdRender pipeline.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setScissorRect()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setScissorRect ( uint32_t x,
uint32_t y,
uint32_t width,
uint32_t height )
pure virtual

Sets the scissor rectangle.

Parameters
xLeft edge.
yTop edge.
widthWidth.
heightHeight.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setVertexBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setVertexBuffer ( uint32_t slot,
BrowserObjectId bufferId,
uint64_t offsetBytes )
pure virtual

Binds a vertex buffer.

Parameters
slotVertex buffer slot.
bufferIdBuffer.
offsetBytesByte offset of the first element.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ setViewport()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::setViewport ( float x,
float y,
float width,
float height,
float minDepth,
float maxDepth )
pure virtual

Sets the viewport.

Parameters
xLeft edge.
yTop edge.
widthWidth.
heightHeight.
minDepthMinimum depth.
maxDepthMaximum depth.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ sharedDeviceIdentity()

virtual const void * donner::gpu::browser::BrowserBridge::sharedDeviceIdentity ( ) const
pure virtual

Identity of the browser device this logical device runs on: the same for every bridge over that device and different for every other, including a device obtained after this one was released.

Null until the request is Ready.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ shareTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::shareTexture ( BrowserObjectId textureId,
std::shared_ptr< const BrowserSharedTexture > & shared )
pure virtual

Holds the texture textureId for the other logical devices over the same browser device.

Parameters
textureIdTexture of this logical device; refused if it is a registration or is already shared.
sharedReceives the share on success.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ submitCommandBuffers()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::submitCommandBuffers ( uint64_t submissionSerial)
pure virtual

Submits every command buffer finished under submissionSerial as one queue submission, in the order they were recorded, and arranges for the reported completed serial to reach submissionSerial once that submission finishes.

Parameters
submissionSerialSerial the runtime assigned.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ surfaceCapabilities()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::surfaceCapabilities ( BrowserObjectId surfaceId,
BrowserSurfaceCapabilities & capabilities ) const
pure virtual

Reports what a surface supports.

Parameters
surfaceIdSurface to query.
capabilitiesReceives the capabilities on success.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ unmapBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::unmapBuffer ( BrowserObjectId mappingId)
pure virtual

Releases a mapping and unregisters its identifier.

Parameters
mappingIdMapping to release.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ writeBuffer()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::writeBuffer ( BrowserObjectId bufferId,
uint64_t offsetBytes,
std::span< const uint8_t > data )
pure virtual

Writes bytes into a buffer.

Parameters
bufferIdDestination buffer.
offsetBytesDestination byte offset.
dataPayload.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ writeTexture()

virtual BridgeStatus donner::gpu::browser::BrowserBridge::writeTexture ( BrowserObjectId textureId,
std::span< const uint8_t > data,
const BrowserTexelLayout & layout,
const BrowserCopyRegion & region )
pure virtual

Writes texel rows into a texture.

Parameters
textureIdDestination texture.
dataPayload.
layoutRow layout of data.
regionDestination rectangle; its source coordinates are unused.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.

◆ yieldToBrowser()

virtual void donner::gpu::browser::BrowserBridge::yieldToBrowser ( double seconds)
pure virtual

Gives the browser up to seconds of this thread to make progress.

A browser settles a mapping on its own event loop, so a caller that waits by blocking prevents the very progress it is waiting for: the promise that would mark the mapping ready cannot run until this thread yields. Resting between slices is not enough, because resting is still not yielding. This is the call that hands the loop back.

How a shipped build yields is not settled. The implementation unwinds the stack, which needs that support enabled at link time and costs module size and speed; the WebAssembly binaries enable it today, but they do so for the transitional WebGPU path this bridge is meant to replace, so its presence is not something this bridge can assume it keeps. The alternatives are stack switching, which is not available on every browser in the support matrix, and making readback asynchronous up the calling stack so nothing ever waits here. That choice belongs to the production cutover and touches renderer code outside this package; until it is made, treat a blocking wait through this call as workable rather than as the shipped design.

Parameters
secondsLongest this call may yield for.

Implemented in donner::gpu::browser::EmscriptenBrowserBridge.


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