---
title: "textureDimensions(): IR builder in typeshade/core/ir"
description: "textureDimensions, an IR builder function in typeshade/core/ir. Texture extent in texels, as a vec2<u32>."
url: https://typeshade.dev/api/texturedimensions/
language: en
---

# `textureDimensions()`

Function in Builtins

Texture extent in texels, as a `vec2<u32>`.

`import { textureDimensions } from 'typeshade/core/ir'`

This export returns an IR node. A `"use typeshade"` file calls the builtin itself: [`textureDimensions()`](https://typeshade.dev/reference/functions/textureDimensions/)

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

## Syntax

```ts
const textureDimensions: (
  tex: ReadonlyNode<TextureLoad2dKey | TextureLoadArrayKey>,
) => Node<"vec2<u32>">
```

## Parameters

**`tex` `ReadonlyNode<TextureLoad2dKey | TextureLoadArrayKey>`**

## Return value

`Node<'vec2<u32>'>`

## Description

A 2D array texture reports its width and height the same way; the layer count is the separate [`textureNumLayers`](https://typeshade.dev/api/texturenumlayers/) query. An integer texture is accepted too, since an extent does not depend on the texel element. On GLSL ES 3.00 the `ivec3` that `textureSize` returns for an array is truncated to the two extent components. Bind the result with `Let` when it is read more than once per invocation.

## Targets

| Target | Support | Notes |
| --- | --- | --- |
| WGSL (WebGPU) | Supported | `textureDimensions(tex)`. |
| GLSL ES 3.00 (WebGL2) | Supported | `uvec2(textureSize(tex, 0))`. |
| CPU oracle | Stub | The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with `{ gpuStubs: true }`, which returns a placeholder. |

## In the guide

- [Layouts and resources](https://typeshade.dev/guide/internals/layouts-and-resources/)
- [The CPU oracle](https://typeshade.dev/guide/internals/the-cpu-oracle/)

## See also

- [`textureDimensions()`](https://typeshade.dev/reference/functions/textureDimensions/)
- [`textureNumLayers`](https://typeshade.dev/api/texturenumlayers/)

## Source

[`src/core/ir/node.ts`, line 1929](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1929), at commit af54ddad5
