GLTEXSTORAGE2DMULTIS(3G)

Okay bestie, welcome to the GLTEXSTORAGE2DMULTIS(3G) page β€” yes, the header literally includes [FIXME: manual], placeholder era, we move. πŸ’… This one covers glTexStorage2DMultisample and glTextureStorage2DMultisample, aka the functions that set up storage for a two-dimensional multisample texture. ✨

🌸 NAME 🌸

glTexStorage2DMultisample, glTextureStorage2DMultisample β€” specify storage for a two-dimensional multisample texture. That's the whole vibe: these functions lock in storage for a 2D multisample texture, periodt. πŸŽ€

✨ C SPECIFICATION ✨

Here's the exact C-level tea, bestie:

       void glTexStorage2DMultisample(GLenum target, GLsizei samples,
                                      GLenum internalformat, GLsizei width,
                                      GLsizei height,
                                      GLboolean fixedsamplelocations);

       void glTextureStorage2DMultisample(GLuint texture, GLsizei samples,
                                          GLenum internalformat, GLsizei width,
                                          GLsizei height,
                                          GLboolean fixedsamplelocations);

πŸŽ€ PARAMETERS πŸŽ€

  • target β€” the target the texture object is bound to for glTexStorage2DMultisample, bestie. It must be one of GL_TEXTURE_2D_MULTISAMPLE or GL_PROXY_TEXTURE_2D_MULTISAMPLE. No other target is invited to this party. πŸ¦‹
  • texture β€” the texture object name for glTextureStorage2DMultisample. The effective target of texture must be one of the valid non-proxy target values above β€” iykyk, not the proxy one. πŸ’…
  • samples β€” the number of samples in the texture. Simple as that. 🌸
  • internalformat β€” the sized internal format used to store texture image data. Sized, okay? It's giving very specific storage requirements. πŸ’–
  • width β€” the width of the texture, in texels. πŸ“
  • height β€” the height of the texture, in texels. πŸ“
  • fixedsamplelocations β€” whether the image will use identical sample locations and the same number of samples for all texels in the image, and whether the sample locations will not depend on the internal format or size of the image. So: same locations, same sample count, no format/size drama. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

glTexStorage2DMultisample and glTextureStorage2DMultisample specify the storage requirements for a two-dimensional multisample texture. Once a texture is specified with this command, its format and dimensions become immutable unless it is a proxy texture. The contents of the image may still be modified, however, its storage requirements may not change. Such a texture is referred to as an immutable-format texture. 🧚

So samples specifies the number of samples to be used for the texture, and it must be greater than zero and less than or equal to the value of GL_MAX_SAMPLES. internalformat must be a color-renderable, depth-renderable, or stencil-renderable format. width and height specify the width and height, respectively, of the texture. If fixedsamplelocations is GL_TRUE, the image will use identical sample locations and the same number of samples for all texels in the image, and the sample locations will not depend on the internal format or size of the image. πŸ”₯

πŸ’… Table 1. Sized Internal Formats

okay bestie, this is the big one β€” the full menu of sized internal formats. Every row gives you the sized format on the left, the base internal format it maps to, then how many red, green, blue, alpha and shared bits you get. Heads up: the Shared Bits column is empty for literally every single row here β€” she's not beating the empty allegations 😭. Empty cells are just… empty, so I'm only calling out the ones that actually have numbers. No cap.

  • GL_R8 β€” base GL_RED, red bits 8. just vibes and one channel πŸ“
  • GL_R8_SNORM β€” base GL_RED, red bits s8
  • GL_R16 β€” base GL_RED, red bits 16
  • GL_R16_SNORM β€” base GL_RED, red bits s16
  • GL_RG8 β€” base GL_RG, red bits 8, green bits 8
  • GL_RG8_SNORM β€” base GL_RG, red bits s8, green bits s8
  • GL_RG16 β€” base GL_RG, red bits 16, green bits 16
  • GL_RG16_SNORM β€” base GL_RG, red bits s16, green bits s16
  • GL_R3_G3_B2 β€” base GL_RGB, red bits 3, green bits 3, blue bits 2. yes the blue girlie gets fewer bits, that's the whole name, periodt πŸ’€
  • GL_RGB4 β€” base GL_RGB, red bits 4, green bits 4, blue bits 4
  • GL_RGB5 β€” base GL_RGB, red bits 5, green bits 5, blue bits 5
  • GL_RGB8 β€” base GL_RGB, red bits 8, green bits 8, blue bits 8
  • GL_RGB8_SNORM β€” base GL_RGB, red bits s8, green bits s8, blue bits s8
  • GL_RGB10 β€” base GL_RGB, red bits 10, green bits 10, blue bits 10
  • GL_RGB12 β€” base GL_RGB, red bits 12, green bits 12, blue bits 12
  • GL_RGB16_SNORM β€” base GL_RGB, red bits 16, green bits 16, blue bits 16
  • GL_RGBA2 β€” base GL_RGB, red bits 2, green bits 2, blue bits 2, alpha bits 2 πŸ‘€ yes, you read the base column right, don't come for me, I'm just reading the table
  • GL_RGBA4 β€” base GL_RGB, red bits 4, green bits 4, blue bits 4, alpha bits 4
  • GL_RGB5_A1 β€” base GL_RGBA, red bits 5, green bits 5, blue bits 5, alpha bits 1. that alpha is fighting for its life fr fr 😭
  • GL_RGBA8 β€” base GL_RGBA, red bits 8, green bits 8, blue bits 8, alpha bits 8. the icon, the moment πŸ‘‘
  • GL_RGBA8_SNORM β€” base GL_RGBA, red bits s8, green bits s8, blue bits s8, alpha bits s8
  • GL_RGB10_A2 β€” base GL_RGBA, red bits 10, green bits 10, blue bits 10, alpha bits 2
  • GL_RGB10_A2UI β€” base GL_RGBA, red bits ui10, green bits ui10, blue bits ui10, alpha bits ui2. those ui prefixes are doing main character work ✨
  • GL_RGBA12 β€” base GL_RGBA, red bits 12, green bits 12, blue bits 12, alpha bits 12
  • GL_RGBA16 β€” base GL_RGBA, red bits 16, green bits 16, blue bits 16, alpha bits 16
  • GL_SRGB8 β€” base GL_RGB, red bits 8, green bits 8, blue bits 8. sRGB girlies rise 🌈
  • GL_SRGB8_ALPHA8 β€” base GL_RGBA, red bits 8, green bits 8, blue bits 8, alpha bits 8
  • GL_R16F β€” base GL_RED, red bits f16. float vibes πŸ¦‹

…okay bestie, we're still in the format chart, keep scrolling with me πŸ’… the pattern is always the same: internal format, then its base format, then what each channel actually holds. lowkey satisfying once you see it.

  • GL_RG16F β€” base GL_RG, channels f16, f16 πŸ’–
  • GL_RGB16F β€” base GL_RGB, channels f16, f16, f16 ✨
  • GL_RGBA16F β€” base GL_RGBA, channels f16, f16, f16, f16 πŸŽ€

and now the 32-bit crowd, they're giving main character energy:

  • GL_R32F β€” base GL_RED, channel f32 πŸ¦‹
  • GL_RG32F β€” base GL_RG, channels f32, f32 🌸
  • GL_RGB32F β€” base GL_RGB, channels f32, f32, f32 πŸ’…
  • GL_RGBA32F β€” base GL_RGBA, channels f32, f32, f32, f32 πŸ”₯

then we get the little weird ones (affectionate) where the channels aren't all the same size:

  • GL_R11F_G11F_B10F β€” base GL_RGB, channels f11, f11, f10 πŸ‘‘
  • GL_RGB9_E5 β€” base GL_RGB, channels 9, 9, 9, plus a shared value of 5 🌈
bestie note: that last column is the shared-bits column, and it's empty for literally everything else in this stretch. GL_RGB9_E5 is the only one carrying a 5 in it. iykyk πŸ’€

now the integer girlies, signed and unsigned, and yes every single one is listed because we don't skip:

  • GL_R8I β€” base GL_RED, channel i8 ⭐
  • GL_R8UI β€” base GL_RED, channel ui8 πŸ’œ
  • GL_R16I β€” base GL_RED, channel i16 πŸ™ˆ
  • GL_R16UI β€” base GL_RED, channel ui16 πŸ“
  • GL_R32I β€” base GL_RED, channel i32 🧚
  • GL_R32UI β€” base GL_RED, channel ui32 ✨

two-channel versions, same deal:

  • GL_RG8I β€” base GL_RG, channels i8, i8 πŸ’–
  • GL_RG8UI β€” base GL_RG, channels ui8, ui8 πŸ¦‹
  • GL_RG16I β€” base GL_RG, channels i16, i16 🌸
  • GL_RG16UI β€” base GL_RG, channels ui16, ui16 πŸ’…
  • GL_RG32I β€” base GL_RG, channels i32, i32 πŸŽ€
  • GL_RG32UI β€” base GL_RG, channels ui32, ui32 🌈

three-channel, she's growing:

  • GL_RGB8I β€” base GL_RGB, channels i8, i8, i8 πŸ‘‘
  • GL_RGB8UI β€” base GL_RGB, channels ui8, ui8, ui8 πŸ”₯
  • GL_RGB16I β€” base GL_RGB, channels i16, i16, i16 ⭐
  • GL_RGB16UI β€” base GL_RGB, channels ui16, ui16, ui16 🧚
  • GL_RGB32I β€” base GL_RGB, channels i32, i32, i32 πŸ’œ
  • GL_RGB32UI β€” base GL_RGB, channels ui32, ui32, ui32 πŸ“

and the four-channel full set, ate and left no crumbs:

  • GL_RGBA8I β€” base GL_RGBA, channels i8, i8, i8, i8 πŸ’–
  • GL_RGBA8UI β€” base GL_RGBA, channels ui8, ui8, ui8, ui8 πŸ¦‹
  • GL_RGBA16I β€” base GL_RGBA, channels i16, i16, i16, i16 🌸
  • GL_RGBA16UI β€” base GL_RGBA, channels ui16, ui16, ui16, ui16 πŸ’…

and that's exactly where this chunk of the chart pauses, bestie β€” the list keeps going, so stay with me 🫢

…and the last of the table rows round it out like this ✨

  • GL_RGBA32I β€” GL_RGBA, i32, i32, i32, i32
  • GL_RGBA32UI β€” GL_RGBA, ui32, ui32, ui32, ui32

πŸ’€ ERRORS πŸ’€

Bestie, here's the full receipts on what goes wrong and which error flag you get for it. Memorize these, they will absolutely show up in your life 😭

  • GL_INVALID_OPERATION β€” thrown by glTexStorage2DMultisample if zero is bound to target.
  • GL_INVALID_OPERATION β€” thrown by glTextureStorage2DMultisample if texture is not the name of an existing texture object.
  • GL_INVALID_ENUM β€” thrown if internalformat is not a valid color-renderable, depth-renderable or stencil-renderable format.
  • GL_INVALID_ENUM β€” thrown if target, or the effective target of texture, is not one of the accepted targets described above.
  • GL_INVALID_VALUE β€” thrown if width or height are less than 1 or greater than the value of GL_MAX_TEXTURE_SIZE.
  • GL_INVALID_VALUE β€” thrown if levels is less than 1.
  • GL_INVALID_VALUE β€” thrown if samples is zero.
  • GL_INVALID_OPERATION β€” thrown if samples is greater than the maximum number of samples supported for this target and internalformat.
  • GL_INVALID_OPERATION β€” thrown if the value of GL_TEXTURE_IMMUTABLE_FORMAT for the texture bound to target is not GL_FALSE.
🫢 Real talk: that last one is the vibe check. If your texture's already immutable, you can't re-spec it. Periodt.

🌈 VERSION SUPPORT 🌈

So which OpenGL versions actually have these? Buckle up, it's giving "late to the party" for both of them πŸ’…

The columns across the top are the OpenGL versions: 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5.

  • glTexStorage2DMultisample β€” - in 2.0, - in 2.1, - in 3.0, - in 3.1, - in 3.2, - in 3.3, - in 4.0, - in 4.1, - in 4.2, then βœ” in 4.3, βœ” in 4.4, βœ” in 4.5.
  • glTextureStorage2DMultisample β€” - all the way down through 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, and only βœ” in 4.5. She's the newest of the new, the main character of 4.5 πŸ‘‘βœ¨

πŸ¦‹ SEE ALSO πŸ¦‹

Go read these next, they're the friends of this function, iykyk:

  • glTexImage2D()
  • glTexImage2DMultisample()
  • glTexStorage1D()
  • glTexStorage3D()

Copyright Β© 2013-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 Β© 2013-2014 Khronos Group

πŸ™ˆ Yes bestie, the copyright block shows up twice in the original β€” the second one is just the short version without the license prose. Not me leaving it out, I would never πŸ’–

And that's the whole page, fr fr πŸ’… (Sourced from [FIXME: source], dated 08/09/2021 β€” the one and only GLTEXSTORAGE2DMULTIS(3G). Slay, go forth and multisample responsibly 🌸)

πŸ“¦ where this page comes from