UNPACKHALF2X16(3G)
β¨ UNPACKHALF2X16 β¨ (that's the 3G manual, bestie)
okay so. this is unpackHalf2x16, a GLSL function that takes one lil 32-bit integer and goes "hm, what if this was actually two tiny floats" and gives you back a vec2. it's giving magical girl transformation but for bits π
πΈ NAME πΈ
unpackHalf2x16 β convert two 16-bit floating-point values packed into a single 32-bit integer into a vector of two 32-bit floating-point quantities
like. two halves. one integer. one vec2. it's a whole unboxing video π¦β¨
π DECLARATION π
vec2 unpackHalf2x16(uint v);
π PARAMETERS π
vβ bestie, you hand over a single 32-bit unsigned integer value that's secretly holding two 16-bit floating point values inside it, waiting to be unpacked. two-for-one, no cap π«Ά
π¦ DESCRIPTION π¦
unpackHalf2x16 returns a two-component floating-point vector. the components come from unpacking a 32-bit unsigned integer into a pair of 16-bit values, interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification, and then converting them to 32-bit floating-point values. periodt, that's the whole job.
the way it splits is lowkey important:
- the first component of the vector comes from the 16 least-significant bits of
vπ± - the second component comes from the 16 most-significant bits of
vπ
so the bits aren't shuffled, they're just chillin' in their assigned seats. main character energy for each half β¨
π₯ VERSION SUPPORT π₯
so like, was she even available back then? here's the vibe check, function by function π°οΈ
Function name: unpackHalf2x16
OpenGL Shading Language Version columns: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50
and the receipts, in order:
1.10β-(nope)1.20β-(nope)1.30β-(nope)1.40β-(nope)1.50β-(nope)3.30β-(nope)4.00β-(nope)4.10β-(nope)4.20ββ(SHE'S HERE π)4.30ββ(still slaying)4.40ββ(still slaying)4.50ββ(still slaying)
tl;dr she showed up in 4.20 and never left. iconic behavior, honestly π
π SEE ALSO π
go bother her siblings, they're all cute:
packDouble2x32()unpackDouble2x32()packHalf2x16()
π 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 (again, yes, it's listed twice, i don't make the rules) π
Copyright Β© 2011-2014 Khronos Group
okay bye bestie, go unpack some halves πβ¨ππ¦
this came from the [FIXME: source] drop, dated 01/03/2018, and the manual page is UNPACKHALF2X16(3G) β mwah, xoxo, go touch some floats πΈπ
π«Ά
π¦ 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