WebGPUAPI¶
Overview¶
WebGPU commands should be run through here, so we can record them for later playback (and possibly other reasons).
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class WebGPUAPI¶
Instance Methods¶
enableRecording()¶
startRecording() : WebGPUCommandList¶
stopRecording( commandList : WebGPUCommandList )¶
getAdapter( options? : GPURequestAdapterOptions ) : Promise<GPUAdapter | null>¶
getPreferredCanvasFormat() : PreferredCanvasFormat¶
adapterHasFeature( adapter : GPUAdapter, featureName : string ) : boolean¶
adapterRequestDevice( adapter : GPUAdapter, descriptor? : GPUDeviceDescriptor ) : Promise<GPUDevice | null>¶
deviceCreateBuffer( device : GPUDevice, descriptor : GPUBufferDescriptor ) : GPUBuffer¶
deviceCreateQuerySet( device : GPUDevice, descriptor : GPUQuerySetDescriptor ) : GPUQuerySet¶
deviceCreateBindGroupLayout( device : GPUDevice, descriptor : GPUBindGroupLayoutDescriptor ) : GPUBindGroupLayout¶
deviceCreatePipelineLayout( device : GPUDevice, descriptor : GPUPipelineLayoutDescriptor ) : GPUPipelineLayout¶
deviceCreateShaderModule( device : GPUDevice, descriptor : GPUShaderModuleDescriptor ) : GPUShaderModule¶
deviceCreateComputePipeline( device : GPUDevice, descriptor : GPUComputePipelineDescriptor ) : GPUComputePipeline¶
deviceCreateComputePipelineAsync( device : GPUDevice, descriptor : GPUComputePipelineDescriptor ) : Promise<GPUComputePipeline>¶
deviceCreateBindGroup( device : GPUDevice, descriptor : GPUBindGroupDescriptor ) : GPUBindGroup¶
deviceCreateCommandEncoder( device : GPUDevice, descriptor? : GPUCommandEncoderDescriptor ) : GPUCommandEncoder¶
deviceWriteBuffer( device : GPUDevice, buffer : GPUBuffer, bufferOffset : number, data : | BufferSource¶
| SharedArrayBuffer</span>, dataOffset? : <span style="font-weight: 400;"><span style="color: hsla(calc(var(--md-hue) + 180deg),80%,40%,1);">number</span></span>, size? : <span style="font-weight: 400;"><span style="color: hsla(calc(var(--md-hue) + 180deg),80%,40%,1);">number</span></span> ) {: #deviceWriteBuffer data-toc-label='deviceWriteBuffer' }
deviceQueueSubmit( device : GPUDevice, commandBuffers : Iterable<GPUCommandBuffer> )¶
deviceHasFeature( device : GPUDevice, featureName : string ) : boolean¶
deviceDestroy( device : GPUDevice )¶
bufferMapAsync( buffer : GPUBuffer, mode : GPUMapModeFlags, offset? : number, size? : number ) : Promise<void>¶
bufferUnmap( buffer : GPUBuffer )¶
bufferGetMappedRange( buffer : GPUBuffer, offset? : number, size? : number ) : ArrayBuffer¶
bufferDestroy( buffer : GPUBuffer )¶
encoderBeginRenderPass( encoder : GPUCommandEncoder, descriptor : GPURenderPassDescriptor ) : GPURenderPassEncoder¶
encoderBeginComputePass( encoder : GPUCommandEncoder, descriptor? : GPUComputePassDescriptor ) : GPUComputePassEncoder¶
encoderCopyBufferToBuffer( encoder : GPUCommandEncoder, source : GPUBuffer, sourceOffset : number, destination : GPUBuffer, destinationOffset : number, size : number )¶
encoderCopyBufferToTexture( encoder : GPUCommandEncoder, source : GPUImageCopyBuffer, destination : GPUImageCopyTexture, copySize : GPUExtent3DStrict )¶
encoderCopyTextureToBuffer( encoder : GPUCommandEncoder, source : GPUImageCopyTexture, destination : GPUImageCopyBuffer, copySize : GPUExtent3DStrict )¶
encoderCopyTextureToTexture( encoder : GPUCommandEncoder, source : GPUImageCopyTexture, destination : GPUImageCopyTexture, copySize : GPUExtent3DStrict )¶
encoderClearBuffer( encoder : GPUCommandEncoder, buffer : GPUBuffer, offset? : number, size? : number )¶
encoderResolveQuerySet( encoder : GPUCommandEncoder, querySet : GPUQuerySet, firstQuery : number, queryCount : number, destination : GPUBuffer, destinationOffset : number )¶
encoderFinish( encoder : GPUCommandEncoder, descriptor? : GPUCommandBufferDescriptor ) : GPUCommandBuffer¶
computePassEncoderSetPipeline( computePassEncoder : GPUComputePassEncoder, pipeline : GPUComputePipeline )¶
computePassEncoderDispatchWorkgroups( computePassEncoder : GPUComputePassEncoder, x : number, y? : number, z? : number )¶
computePassEncoderDispatchWorkgroupsIndirect( computePassEncoder : GPUComputePassEncoder, indirectBuffer : GPUBuffer, indirectOffset : number )¶
passEncoderSetBindGroup( passEncoder : GPURenderPassEncoder | GPUComputePassEncoder, index : number, bindGroup : GPUBindGroup | null, dynamicOffsets? : Iterable<number> )¶
TODO: consider adding the other approach to dynamic offsets?
computePassEncoderEnd( computePassEncoder : GPUComputePassEncoder )¶
querySetDestroy( querySet : GPUQuerySet )¶
Instance Properties¶
recorder : WebGPURecorder | null¶
Type PreferredCanvasFormat¶
"bgra8unorm" | "rgba8unorm"
Source Code¶
See the source for WebGPUAPI.ts in the alpenglow repository.