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

# Interface GPUTexture

The **`GPUTexture`** interface of the WebGPU API represents a container used to store 1D, 2D, or 3D arrays of data, such as images, to use in GPU rendering operations. Available only in secure contexts.

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

interface GPUTexture {  
    [depthOrArrayLayers](#depthorarraylayers): number;  
    [dimension](#dimension): [GPUTextureDimension](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GPUTextureDimension/);  
    [format](#format): [GPUTextureFormat](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GPUTextureFormat/);  
    [height](#height): number;  
    [label](#label): string;  
    [mipLevelCount](#miplevelcount): number;  
    [sampleCount](#samplecount): number;  
    [usage](#usage): number;  
    [width](#width): number;  
    [createView](#createview-1)(descriptor?: [GPUTextureViewDescriptor](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureViewDescriptor/)): [GPUTextureView](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureView/);  
    [destroy](#destroy-1)(): void;  
}

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#Externals.GPUTexture))

-   [GPUObjectBase](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUObjectBase/)
    -   GPUTexture

##### Index

### Properties[](#properties)

[depthOrArrayLayers](#depthorarraylayers) [dimension](#dimension) [format](#format) [height](#height) [label](#label) [mipLevelCount](#miplevelcount) [sampleCount](#samplecount) [usage](#usage) [width](#width)

### Methods[](#methods)

[createView](#createview) [destroy](#destroy)

## Properties[](#properties-1)

### `Readonly`depthOrArrayLayers[](#depthorarraylayers)

depthOrArrayLayers: number

The **`depthOrArrayLayers`** read-only property of the GPUTexture interface represents the depth or layer count of the GPUTexture.

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

### `Readonly`dimension[](#dimension)

dimension: [GPUTextureDimension](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GPUTextureDimension/)

The **`dimension`** read-only property of the GPUTexture interface represents the dimension of the set of texels for each GPUTexture subresource.

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

### `Readonly`format[](#format)

format: [GPUTextureFormat](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GPUTextureFormat/)

The **`format`** read-only property of the GPUTexture interface represents the format of the GPUTexture.

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

### `Readonly`height[](#height)

height: number

The **`height`** read-only property of the GPUTexture interface represents the height of the GPUTexture.

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

### label[](#label)

label: string

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

Inherited from [GPUObjectBase](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUObjectBase/).[label](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUObjectBase/#label)

### `Readonly`mipLevelCount[](#miplevelcount)

mipLevelCount: number

The **`mipLevelCount`** read-only property of the GPUTexture interface represents the number of mip levels of the GPUTexture.

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

### `Readonly`sampleCount[](#samplecount)

sampleCount: number

The **`sampleCount`** read-only property of the GPUTexture interface represents the sample count of the GPUTexture.

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

### `Readonly`usage[](#usage)

usage: number

The **`usage`** read-only property of the GPUTexture interface is the bitwise flags representing the allowed usages of the GPUTexture.

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

### `Readonly`width[](#width)

width: number

The **`width`** read-only property of the GPUTexture interface represents the width of the GPUTexture.

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

## Methods[](#methods-1)

### createView[](#createview)

-   createView(descriptor?: [GPUTextureViewDescriptor](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureViewDescriptor/)): [GPUTextureView](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureView/)[](#createview-1)
    
    The **`createView()`** method of the GPUTexture interface creates a GPUTextureView representing a specific view of the GPUTexture.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUTexture/createView)
    
    #### Parameters
    
    -   `Optional`descriptor: [GPUTextureViewDescriptor](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureViewDescriptor/)
    
    #### Returns [GPUTextureView](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.GPUTextureView/)
    

### destroy[](#destroy)

-   destroy(): void[](#destroy-1)
    
    The **`destroy()`** method of the GPUTexture interface destroys the GPUTexture.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUTexture/destroy)
    
    #### Returns void
