Skip to content

CanvasSurface

class CanvasSurface(val handler: WGPUCanvasContext) : AutoCloseable
A configured WebGPU canvas context. The textures it hands out are borrowed from the canvas: closing their wrapper never destroys them.

Constructors

CanvasSurface

constructor(handler: WGPUCanvasContext)

Properties

handler

val handler: WGPUCanvasContext

height

val height: UInt

preferredCanvasFormat

val preferredCanvasFormat: GPUTextureFormat?

width

val width: UInt

Functions

close

open override fun close()
Unconfigures the canvas context. The device passed to [`configure`](index.md#configure) is not owned by this surface and is not closed.

configure

fun configure(configuration: SurfaceConfiguration)

getCurrentTexture

present

fun present()
Presentation is handled by the browser once the pass is submitted.