Light | Dark

# docs.GL

GLSL 4
GLSL ES 3

# textureSize

## Name

textureSize — retrieve the dimensions of a level of a texture

## Declaration

`ivec2 textureSize(` | gsampler2D sampler,
| int lod`)`;

`ivec3 textureSize(` | gsampler3D sampler,
| int lod`)`;

`ivec2 textureSize(` | gsamplerCube sampler,
| int lod`)`;

`ivec2 textureSize(` | sampler2DShadow sampler,
| int lod`)`;

`ivec2 textureSize(` | samplerCubeShadow sampler,
| int lod`)`;

`ivec3 textureSize(` | gsampler2DArray sampler,
| int lod`)`;

`ivec3 textureSize(` | sampler2DArrayShadow sampler,
| int lod`)`;

## Parameters

`sampler`

  Specifies the sampler to which the texture whose dimensions to retrieve is bound.

`lod`

  Specifies the level of the texture for which to retrieve the dimensions.

## Description

`textureSize` returns the dimensions of level `lod` (if present) of the texture bound to `sampler`. The components in the return value are filled in, in order, with the width, height and depth of the texture. For the array forms, the last component of the return value is the number of layers in the texture array. The return values are returned as highp ints.

## Version Support

| OpenGL ES Shading Language Version
--- | ---
Function Name | 1.00 | 3.00 | 3.10
textureSize | - | ✔ | ✔

## See Also

texelFetch, texelFetchOffset, texture, textureGrad, textureGradOffset, textureLod, textureLodOffset, textureOffset, textureProj, textureProjGrad, textureProjGradOffset, textureProjLod, textureProjLodOffset, textureProjOffset,

## Copyright

Copyright © 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.