# BindTextureFormat

Class · extends [`BindBaseFormat`](https://api.playcanvas.com/engine/classes/BindBaseFormat.md) · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/platform/graphics/bind-group-format.js#L122

A class to describe the format of the texture for [BindGroupFormat](https://api.playcanvas.com/engine/classes/BindGroupFormat.md).

## Constructors

### constructor

```ts
new BindTextureFormat(name: string, visibility: number, textureDimension?: string, sampleType?: number, hasSampler?: boolean, samplerName?: string | null, multisampled?: boolean)
```

Create a new instance.

**Parameters**

- `name` (`string`): The name of the texture.
- `visibility` (`number`): A bit-flag that specifies the shader stages in which the texture
  is visible. Can be:

  - [SHADERSTAGE_VERTEX](https://api.playcanvas.com/engine/variables/SHADERSTAGE_VERTEX.md)
  - [SHADERSTAGE_FRAGMENT](https://api.playcanvas.com/engine/variables/SHADERSTAGE_FRAGMENT.md)
  - [SHADERSTAGE_COMPUTE](https://api.playcanvas.com/engine/variables/SHADERSTAGE_COMPUTE.md)
- `textureDimension` (`string`, optional, default `TEXTUREDIMENSION_2D`): The dimension of the texture. Defaults to
  [TEXTUREDIMENSION_2D](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_2D.md). Can be:

  - [TEXTUREDIMENSION_1D](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_1D.md)
  - [TEXTUREDIMENSION_2D](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_2D.md)
  - [TEXTUREDIMENSION_2D_ARRAY](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_2D_ARRAY.md)
  - [TEXTUREDIMENSION_CUBE](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_CUBE.md)
  - [TEXTUREDIMENSION_CUBE_ARRAY](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_CUBE_ARRAY.md)
  - [TEXTUREDIMENSION_3D](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_3D.md)

  When `multisampled` is true, must be [TEXTUREDIMENSION_2D](https://api.playcanvas.com/engine/variables/TEXTUREDIMENSION_2D.md).
- `sampleType` (`number`, optional, default `SAMPLETYPE_FLOAT`): The type of the texture samples. Defaults to
  [SAMPLETYPE_FLOAT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_FLOAT.md). Can be:

  - [SAMPLETYPE_FLOAT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_FLOAT.md)
  - [SAMPLETYPE_UNFILTERABLE_FLOAT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_UNFILTERABLE_FLOAT.md)
  - [SAMPLETYPE_DEPTH](https://api.playcanvas.com/engine/variables/SAMPLETYPE_DEPTH.md)
  - [SAMPLETYPE_INT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_INT.md)
  - [SAMPLETYPE_UINT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_UINT.md)

  When `multisampled` is true, [SAMPLETYPE_FLOAT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_FLOAT.md) is coerced to
  [SAMPLETYPE_UNFILTERABLE_FLOAT](https://api.playcanvas.com/engine/variables/SAMPLETYPE_UNFILTERABLE_FLOAT.md) (WebGPU rejects `sampleType: "float"` on a
  multisampled binding).
- `hasSampler` (`boolean`, optional, default `true`): True if the sampler for the texture is needed. Note that if the
  sampler is used, it will take up an additional slot, directly following the texture slot.
  Defaults to true. Forced to false when `multisampled` is true.
- `samplerName` (`string | null`, optional, default `null`): Sampler uniform name. If omitted, generated as
  `${name}_sampler`. Ignored and stored as `null` when `multisampled` is true.
- `multisampled` (`boolean`, optional, default `false`): True if this is a multisampled texture binding
  (`texture_multisampled_2d` / `texture_depth_multisampled_2d`). When set, `hasSampler` is
  forced to false and `samplerName` to null (WGSL only allows `textureLoad`, and a WebGPU
  multisampled texture binding cannot be paired with a sampler). Defaults to false.

## Properties

### hasSampler

```ts
hasSampler: boolean
```

Whether a sampler binding follows this texture. Always false when `multisampled` is true.

### multisampled

```ts
multisampled: boolean
```

Whether this is a multisampled (`texture_multisampled_*`) binding.

### samplerName

```ts
samplerName: string | null = null
```

Sampler uniform name. `null` when `multisampled` is true; otherwise the provided name or
`${name}_sampler`.

## Inherited from [BindBaseFormat](https://api.playcanvas.com/engine/classes/BindBaseFormat.md)

- `name: string`
