TEXTURESIZE(3G)
β¨ TEXTURESIZE(3G) β¨
okay bestie, pull up a chair π«Ά welcome to TEXTURESIZE(3G) β the manual page that answers the one question every shader girl eventually asks: "bestie, how big is my texture level actually?" π
πΈ NAME πΈ
textureSize β retrieve the dimensions of a level of a texture
π DECLARATION π
here's the whole lineup, no cap, every single overload, exactly as written:
int textureSize(gsampler1D sampler, int lod);
ivec2 textureSize(gsampler2D sampler, int lod);
ivec3 textureSize(gsampler3D sampler, int lod);
ivec2 textureSize(gsamplerCube sampler, int lod);
int textureSize(sampler1DShadow sampler, int lod);
ivec2 textureSize(sampler2DShadow sampler, int lod);
ivec2 textureSize(samplerCubeShadow sampler, int lod);
ivec3 textureSize(samplerCubeArray sampler, int lod);
ivec3 textureSize(samplerCubeArrayShadow sampler, int lod);
ivec2 textureSize(gsamplerRect sampler);
ivec2 textureSize(gsamplerRectShadow sampler);
ivec2 textureSize(gsampler1DArray sampler, int lod);
ivec3 textureSize(gsampler2DArray sampler, int lod);
ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
int textureSize(gsamplerBuffer sampler);
ivec2 textureSize(gsampler2DMS sampler);
ivec3 textureSize(gsampler2DMSArray sampler);
eighteen overloads. EIGHTEEN. she's giving versatility, she's giving range, she contains multitudes π
π¦ PARAMETERS π¦
samplerβ the sampler that the texture you're snooping on the size of is bound to. it's giving "which texture are we talking about, babe".lodβ the level of the texture you wanna get the dimensions of. yes, the mipmap level. you know the one.
π DESCRIPTION π
okay so the tea β β textureSize returns the dimensions of level lod (if present, like, if it's there) of the texture bound to sampler.
the components in the return value get filled in, in order, with the width, height, and depth of the texture. so it's just... giving you the numbers, in that order, every time. no surprises. iconic behaviour honestly β¨
and for the array forms? the last component of the return value is the number of layers in the texture array. so instead of depth, you get layers. periodt. π
π VERSION SUPPORT π
this is the part where we find out which GLSL version said "yes queen" and which one said "not today". the original is a whole table so here it is, unrolled, every single version, every single β or -. i'm not skipping a crumb bestie π
textureSize
- GLSL 1.10 β
- - GLSL 1.20 β
- - GLSL 1.30 β β
- GLSL 1.40 β β
- GLSL 1.50 β β
- GLSL 3.30 β β
- GLSL 4.00 β β
- GLSL 4.10 β β
- GLSL 4.20 β β
- GLSL 4.30 β β
- GLSL 4.40 β β
- GLSL 4.50 β β
textureSize (samplerBuffer, samplerRect{Shadow})
- GLSL 1.10 β
- - GLSL 1.20 β
- - GLSL 1.30 β
- - GLSL 1.40 β β
- GLSL 1.50 β β
- GLSL 3.30 β β
- GLSL 4.00 β β
- GLSL 4.10 β β
- GLSL 4.20 β β
- GLSL 4.30 β β
- GLSL 4.40 β β
- GLSL 4.50 β β
textureSize (samplerCube{Shadow})
- GLSL 1.10 β
- - GLSL 1.20 β
- - GLSL 1.30 β
- - GLSL 1.40 β
- - GLSL 1.50 β
- - GLSL 3.30 β
- - GLSL 4.00 β β
- GLSL 4.10 β β
- GLSL 4.20 β β
- GLSL 4.30 β β
- GLSL 4.40 β β
- GLSL 4.50 β β
cube shadow variants really said "i'll arrive when i'm ready" and showed up in 4.00 π
π SEE ALSO π
go read these next, bestie, they're the whole friend group π«Ά
texelFetch(), texelFetchOffset(), texture(), textureGather(), textureGatherOffset(), textureGatherOffsets(), textureGrad(), textureGradOffset(), textureLod(), textureLodOffset(), textureOffset(), textureProj(), textureProjGrad(), textureProjGradOffset(), textureProjLod(), textureProjLodOffset(), textureProjOffset(), textureQueryLod()
π 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. http://opencontent.org/openpub/.
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group
and that's the whole page, babe π§ that was TEXTURESIZE(3G) β sourced from [FIXME: source], dated 01/03/2018. mwah, go forth and query your texture dimensions responsibly ππ
π¦ where this page comes from
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms