---
title: "GPUCanvasContext | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# Interface GPUCanvasContext

The **`GPUCanvasContext`** interface of the WebGPU API represents the WebGPU rendering context of a

element, returned via an HTMLCanvasElement.getContext() call with a contextType of "webgpu". Available only in secure contexts.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext)

interface GPUCanvasContext {  
    [canvas](#canvas): [OffscreenCanvas](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.OffscreenCanvas/) | [HTMLCanvasElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCanvasElement/);  
    [configure](#configure-1)(configuration: [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/)): void;  
    [getConfiguration](#getconfiguration-1)(): [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/) | null;  
    [getCurrentTexture](#getcurrenttexture-1)(): [GPUTexture](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTexture/);  
    [unconfigure](#unconfigure-1)(): void;  
}

##### Index

### Properties[](#properties)

[canvas](#canvas)

### Methods[](#methods)

[configure](#configure) [getConfiguration](#getconfiguration) [getCurrentTexture](#getcurrenttexture) [unconfigure](#unconfigure)

## Properties[](#properties-1)

### `Readonly`canvas[](#canvas)

canvas: [OffscreenCanvas](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.OffscreenCanvas/) | [HTMLCanvasElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCanvasElement/)

The **`canvas`** read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/canvas)

## Methods[](#methods-1)

### configure[](#configure)

-   configure(configuration: [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/)): void[](#configure-1)
    
    The **`configure()`** method of the GPUCanvasContext interface configures the context to use for rendering with a given GPUDevice. When called the canvas will initially be cleared to transparent black.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/configure)
    
    #### Parameters
    
    -   configuration: [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/)
    
    #### Returns void
    

### getConfiguration[](#getconfiguration)

-   getConfiguration(): [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/) | null[](#getconfiguration-1)
    
    The **`getConfiguration()`** method of the GPUCanvasContext interface returns the current configuration set for the context.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getConfiguration)
    
    #### Returns [GPUCanvasConfiguration](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUCanvasConfiguration/) | null
    

### getCurrentTexture[](#getcurrenttexture)

-   getCurrentTexture(): [GPUTexture](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTexture/)[](#getcurrenttexture-1)
    
    The **`getCurrentTexture()`** method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/getCurrentTexture)
    
    #### Returns [GPUTexture](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTexture/)
    

### unconfigure[](#unconfigure)

-   unconfigure(): void[](#unconfigure-1)
    
    The **`unconfigure()`** method of the GPUCanvasContext interface removes any previously-set context configuration, and destroys any textures returned via getCurrentTexture() while the canvas context was configured.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUCanvasContext/unconfigure)
    
    #### Returns void
