---
title: "texture_2d: type in the TypeShade language reference"
description: "texture_2d, a type in the TypeShade language reference. A sampled 2D texture of f32, i32 or u32 texels, read with textureLoad…"
url: https://typeshade.dev/reference/types/texture_2d/
language: en
---

# `texture_2d`

Type

A sampled 2D texture of `f32`, `i32` or `u32` texels, read with `textureLoad`, or filtered with `textureSample` when its texels are `f32`.

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

## Syntax

```ts
type texture_2d<E extends TextureElem = f32> = { readonly [textureTag]: readonly [E, false] }
```

A signature may name a type the ambient file declares for its own use. These are those declarations.

**`TextureElem`**

`type TextureElem = f32 | i32 | u32`

## Parameters

- `E` optional `TextureElem`

## Description

A resource, declared as `declare const t: texture_2d<f32>`.

## Examples

- [`gallery/cube-array-gather/cube-array-gather.shade.ts`](https://typeshade.dev/guide/examples/cube-array-gather/)
- [`gallery/cube-env/cube-env.shade.ts`](https://typeshade.dev/guide/examples/cube-env/)
- [`gallery/feedback-trail/feedback-trail.shade.ts`](https://typeshade.dev/guide/examples/feedback-trail/)
- [`gallery/kernel-image-invert/kernel-image-invert.shade.ts`](https://typeshade.dev/guide/examples/kernel-image-invert/)
- [`gallery/sample-branch/sample-branch.shade.ts`](https://typeshade.dev/guide/examples/sample-branch/)
- [`gallery/separable-blur/separable-blur.shade.ts`](https://typeshade.dev/guide/examples/separable-blur/)
- [`gallery/textured-quad/textured-quad.shade.ts`](https://typeshade.dev/guide/examples/textured-quad/)

## See also

- [Types](https://typeshade.dev/reference/types/)
