# UniformBufferFormat

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/platform/graphics/uniform-buffer-format.js#L256

A descriptor that defines the layout of data inside the uniform buffer.

## Constructors

### constructor

```ts
new UniformBufferFormat(graphicsDevice: GraphicsDevice, uniforms: UniformFormat[], options?: object)
```

Create a new UniformBufferFormat instance.

**Parameters**

- `graphicsDevice` ([`GraphicsDevice`](https://api.playcanvas.com/engine/classes/GraphicsDevice.md)): The graphics device.
- `uniforms` ([`UniformFormat`](https://api.playcanvas.com/engine/classes/UniformFormat.md)`[]`): An array of uniforms to be stored in the buffer.
- `options` (`object`, optional, default `{}`): Options.
    - `options.pack` (`boolean`, optional): Reorder the uniforms to minimize the padding of the std140
      layout: uniforms occupying whole 16-byte rows first (vec4, matrices and arrays), then each
      vec3 followed by a scalar, then vec2s and the remaining scalars. The uniforms of the format
      are then in layout order rather than in the order of the array. Only use it when the shader
      declaration of the buffer is generated from this format, and never against a hand-written
      declaration, whose member order has to match the array. Defaults to false.

## Properties

### uniforms

```ts
uniforms: UniformFormat[]
```

## Methods

### get

```ts
get(name: string): UniformFormat | undefined
```

Returns format of a uniform with specified name. Returns undefined if the uniform is not found.

**Parameters**

- `name` (`string`): The name of the uniform.

**Returns** [`UniformFormat`](https://api.playcanvas.com/engine/classes/UniformFormat.md) `| undefined`: - The format of the uniform.
