---
title: "texture(): function in Runtime, TypeShade API reference"
description: "texture, a function in Runtime. A texture of the block's default device: using _ = device.use() names the device…"
url: https://typeshade.dev/api/texture/
language: en
---

# `texture()`

Function in Runtime

A texture of the block's default device: using \_ = device.use() names the device, and the texture is the one device.texture(options) makes.

`import { texture } from 'typeshade/runtime'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
function texture(options: {
  readonly size: readonly [number, number];
  readonly format: string;
  readonly storage?: boolean;
}): Texture
```

## Parameters

**`options` `{ readonly size: readonly [number, number]; readonly format: string; readonly storage?: boolean; }`**

`size` and `format`, as `device.texture()` takes them.

## Return value

`Texture`

the device’s texture.

## Exceptions

**`TypeError`**

`TypeError` when no device is in use, and as `device.texture()` throws.

## Description

A texture lives on its device only, so it takes no range of the region (R17).

## In the guide

- [Functions and entry points](https://typeshade.dev/guide/internals/functions-and-entry-points/)
- [The CPU oracle](https://typeshade.dev/guide/internals/the-cpu-oracle/)

## See also

- [`f64T`](https://typeshade.dev/api/f64t/)
- [`storageBuffer`](https://typeshade.dev/api/storagebuffer/)

## Source

[`src/runtime/resource.ts`, line 1129](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/resource.ts#L1129), at commit af54ddad5
