UNPACKHALF2X16(3G)

πŸ“¦
version 1.0~svn33624 Β· 4 versions
, in ubuntu jammy, ubuntu noble

✨ 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 Β© 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 Β© 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