> ## Documentation Index
> Fetch the complete documentation index at: https://rive-new-accounts-links.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GPUBuffer

A GPU buffer for vertex, index, or uniform data.

## Fields

### `size`

Size in bytes.

## Constructors

### `new`

<div class="signature">
  ```lua theme={null}
  new(desc: GPUBufferDesc) -> GPUBuffer
  ```
</div>

## Methods

### `write`

<div class="signature">
  ```lua theme={null}
  write(data: buffer, offset: number?, srcOffset: number?, byteLength: number?) -> ()
  ```
</div>

Copy CPU data into the buffer.
@param data       Source bytes.
@param offset     Byte offset into the GPU buffer (default 0).
@param srcOffset  Byte offset into `data` to copy from (default 0).
@param byteLength Bytes to copy (default: the rest of `data` from
`srcOffset`). Lets a script upload a prefix of an
oversized staging buffer without slicing it.
