Skip to content

WebGPURecorder

Overview

Responsible for recording GPU commands globally, so we can play them back later.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class WebGPURecorder

import { WebGPURecorder } from 'scenerystack/alpenglow';

Instance Methods

start() : WebGPUCommandList

stop( commandList : WebGPUCommandList )

recordGetAdapter( result : GPUAdapter | null, options? : GPURequestAdapterOptions )

recordAdapterRequestDevice( result : GPUDevice, adapter : GPUAdapter, descriptor? : GPUDeviceDescriptor )

recordDeviceCreateBuffer( result : GPUBuffer, device : GPUDevice, descriptor : GPUBufferDescriptor )

recordDeviceCreateQuerySet( result : GPUQuerySet, device : GPUDevice, descriptor : GPUQuerySetDescriptor )

recordDeviceCreateBindGroupLayout( result : GPUBindGroupLayout, device : GPUDevice, descriptor : GPUBindGroupLayoutDescriptor )

recordDeviceCreatePipelineLayout( result : GPUPipelineLayout, device : GPUDevice, descriptor : GPUPipelineLayoutDescriptor )

recordDeviceCreateShaderModule( result : GPUShaderModule, device : GPUDevice, descriptor : GPUShaderModuleDescriptor )

recordDeviceCreateComputePipeline( result : GPUComputePipeline, device : GPUDevice, descriptor : GPUComputePipelineDescriptor, async : boolean )

recordDeviceCreateBindGroup( result : GPUBindGroup, device : GPUDevice, descriptor : GPUBindGroupDescriptor )

recordDeviceCreateCommandEncoder( result : GPUCommandEncoder, device : GPUDevice, descriptor? : GPUCommandEncoderDescriptor )

recordDeviceWriteBuffer( device : GPUDevice, buffer : GPUBuffer, bufferOffset : number, data : BufferSource | SharedArrayBuffer, dataOffset? : number, size? : number )

recordDeviceQueueSubmit( device : GPUDevice, commandBuffers : Iterable<GPUCommandBuffer> )

recordDeviceDestroy( device : GPUDevice )

recordBufferMapAsync( buffer : GPUBuffer, mode : GPUMapModeFlags, offset? : number, size? : number )

recordBufferUnmap( buffer : GPUBuffer )

recordBufferDestroy( buffer : GPUBuffer )

recordEncoderBeginRenderPass( result : GPURenderPassEncoder, commandEncoder : GPUCommandEncoder, descriptor : GPURenderPassDescriptor )

recordEncoderBeginComputePass( result : GPUComputePassEncoder, commandEncoder : GPUCommandEncoder, descriptor? : GPUComputePassDescriptor )

recordEncoderCopyBufferToBuffer( encoder : GPUCommandEncoder, source : GPUBuffer, sourceOffset : number, destination : GPUBuffer, destinationOffset : number, size : number )

recordEncoderCopyBufferToTexture( encoder : GPUCommandEncoder, source : GPUImageCopyBuffer, destination : GPUImageCopyTexture, copySize : GPUExtent3DStrict )

recordEncoderCopyTextureToBuffer( encoder : GPUCommandEncoder, source : GPUImageCopyTexture, destination : GPUImageCopyBuffer, copySize : GPUExtent3DStrict )

recordEncoderCopyTextureToTexture( encoder : GPUCommandEncoder, source : GPUImageCopyTexture, destination : GPUImageCopyTexture, copySize : GPUExtent3DStrict )

recordEncoderClearBuffer( encoder : GPUCommandEncoder, buffer : GPUBuffer, offset? : number, size? : number )

recordEncoderResolveQuerySet( encoder : GPUCommandEncoder, querySet : GPUQuerySet, firstQuery : number, queryCount : number, destination : GPUBuffer, destinationOffset : number )

recordEncoderFinish( result : GPUCommandBuffer, encoder : GPUCommandEncoder, descriptor? : GPUCommandBufferDescriptor )

recordComputePassEncoderSetPipeline( encoder : GPUComputePassEncoder, pipeline : GPUComputePipeline )

recordComputePassEncoderDispatchWorkgroups( encoder : GPUComputePassEncoder, x : number, y? : number, z? : number )

recordComputePassEncoderDispatchWorkgroupsIndirect( encoder : GPUComputePassEncoder, indirectBuffer : GPUBuffer, indirectOffset : number )

recordComputePassEncoderEnd( encoder : GPUComputePassEncoder )

recordPassEncoderSetBindGroup( passEncoder : GPURenderPassEncoder | GPUComputePassEncoder, index : number, bindGroup : GPUBindGroup | null, dynamicOffsets? : Iterable<number> )

recordQuerySetDestroy( querySet : GPUQuerySet )

Static Methods

getNamePrefix( obj : IntentionalAny ) : string

createNameMap( objects : IntentionalAny[] ) : Map<IntentionalAny, string>

arrayBufferLikeString( data : ArrayLike<number> | ArrayBufferLike ) : string

TODO: consider how we're handling this

objectToString( level : number, map : Record<string, string | undefined> ) : string

rawValue( level : number, value : IntentionalAny, nameMap? : Map<IntentionalAny, string>, objectOverrides? : Record<string, ( value: IntentionalAny ) => string> ) : string | undefined

bitfieldToString( bitfield : number, nameMap : Map<number, string> ) : string

Class WebGPUCommand

import { WebGPUCommand } from 'scenerystack/alpenglow';

Constructor

new WebGPUCommand( result : IntentionalAny | null, dependencies : IntentionalAny[] )

Instance Methods

toJS( nameMap : Map<IntentionalAny, string>, level? : number ) : string

getDeclaration( nameMap : Map<IntentionalAny, string> ) : string

(protected)

Class WebGPUCommandList

import { WebGPUCommandList } from 'scenerystack/alpenglow';

Constructor

new WebGPUCommandList( commands : WebGPUCommand[] )

Instance Methods

push( command : WebGPUCommand )

getDeclaredObjects() : IntentionalAny[]

getUnboundObjects( declaredObjects : IntentionalAny[] ) : IntentionalAny[]

getObjects() : IntentionalAny[]

getNameMap() : Map<IntentionalAny, string>

toJS( nameMap : Map<IntentionalAny, string>, level ) : string

toJSClosure( nameMap : Map<IntentionalAny, string>, level ) : string

Source Code

See the source for WebGPURecorder.ts in the alpenglow repository.