textureDimensions()
Function in Builtins
Texture extent in texels, as a vec2<u32>.
import { textureDimensions } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
const textureDimensions: ( tex: ReadonlyNode<TextureLoad2dKey | TextureLoadArrayKey>,) => Node<"vec2<u32>">Parameters
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 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 |
|
| GLSL ES 3.00 (WebGL2) | Supported |
|
| CPU oracle | Stub | The oracle has no texture memory and no neighbouring fragments. The call throws unless the module was compiled with |
In the guide
See also
Source
src/core/ir/node.ts, line 2193, at commit 26de7be8