# BindGroupFormat

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/platform/graphics/bind-group-format.js#L299

BindGroupFormat is a data structure that defines the layout of resources (buffers, textures,
samplers) used by rendering or compute shaders. It describes the binding points for each
resource type, and the visibility of these resources in the shader stages.
Currently this class is only used on WebGPU platform to specify the input and output resources
for vertex, fragment and compute shaders written in [SHADERLANGUAGE_WGSL](https://api.playcanvas.com/engine/variables/SHADERLANGUAGE_WGSL.md) language.

Call [BindGroupFormat#destroy](https://api.playcanvas.com/engine/classes/BindGroupFormat.md#destroy) when no longer needed. On WebGPU, the graphics device
retains bind group formats for device recovery until they are explicitly destroyed.

## Constructors

### constructor

```ts
new BindGroupFormat(graphicsDevice: GraphicsDevice, formats: (BindTextureFormat | BindStorageTextureFormat | BindUniformBufferFormat | BindStorageBufferFormat)[])
```

Create a new instance.

**Parameters**

- `graphicsDevice` ([`GraphicsDevice`](https://api.playcanvas.com/engine/classes/GraphicsDevice.md)): The graphics device used to manage this vertex format.
- `formats` (`(`[`BindTextureFormat`](https://api.playcanvas.com/engine/classes/BindTextureFormat.md) `|` [`BindStorageTextureFormat`](https://api.playcanvas.com/engine/classes/BindStorageTextureFormat.md) `|` [`BindUniformBufferFormat`](https://api.playcanvas.com/engine/classes/BindUniformBufferFormat.md) `|` [`BindStorageBufferFormat`](https://api.playcanvas.com/engine/classes/BindStorageBufferFormat.md)`)[]`): An array of bind formats. Note that each entry in the array uses up one slot. The exception
  is a texture format that has a sampler, which uses up two slots. The slots are allocated
  sequentially, starting from 0.

## Properties

### bufferFormatsMap

```ts
bufferFormatsMap: Map<string, number>
```

### device

```ts
device: GraphicsDevice
```

### storageBufferFormatsMap

```ts
storageBufferFormatsMap: Map<string, number>
```

### storageTextureFormatsMap

```ts
storageTextureFormatsMap: Map<string, number>
```

### textureFormatsMap

```ts
textureFormatsMap: Map<string, number>
```

## Methods

### destroy

```ts
destroy(): void
```

Frees resources associated with this bind group.
