From 36c521e684f5db743e7f4737d0d54455b2a10b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Jun 2026 19:23:06 +0200 Subject: [PATCH] Text: GL::textureFormat() actually never returns sized formats on ES2. So this branch can be just an assert and the never covered setStorage() call can be removed. --- src/Magnum/Text/GlyphCacheGL.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Magnum/Text/GlyphCacheGL.cpp b/src/Magnum/Text/GlyphCacheGL.cpp index 129b1380b..cd2c43cac 100644 --- a/src/Magnum/Text/GlyphCacheGL.cpp +++ b/src/Magnum/Text/GlyphCacheGL.cpp @@ -72,19 +72,19 @@ GlyphCacheGL::State::State(const PixelFormat format, const Vector2i& size, const pixelFormat = GL::PixelFormat::Red; } - /* And use setImage() instead of setStorage() if the format is unsized, as - EXT_texture_storage doesn't allow those */ - if(textureFormat == GL::TextureFormat::Red || - textureFormat == GL::TextureFormat::Luminance || - textureFormat == GL::TextureFormat::RG || - textureFormat == GL::TextureFormat::LuminanceAlpha || - textureFormat == GL::TextureFormat::RGB || - textureFormat == GL::TextureFormat::SRGB || - textureFormat == GL::TextureFormat::RGBA || - textureFormat == GL::TextureFormat::SRGBAlpha) - texture.setImage(0, textureFormat, ImageView2D{pixelFormat, GL::PixelType::UnsignedByte, processedSize}); - else - texture.setStorage(1, textureFormat, processedSize); + /* On ES2, GL::textureFormat() always produces an unsized format, so we + have to use setImage() instead of setStorage() as EXT_texture_storage + doesn't allow those */ + CORRADE_INTERNAL_ASSERT( + textureFormat == GL::TextureFormat::Red || + textureFormat == GL::TextureFormat::Luminance || + textureFormat == GL::TextureFormat::RG || + textureFormat == GL::TextureFormat::LuminanceAlpha || + textureFormat == GL::TextureFormat::RGB || + textureFormat == GL::TextureFormat::SRGB || + textureFormat == GL::TextureFormat::RGBA || + textureFormat == GL::TextureFormat::SRGBAlpha); + texture.setImage(0, textureFormat, ImageView2D{pixelFormat, GL::PixelType::UnsignedByte, processedSize}); #else texture.setStorage(1, GL::textureFormat(processedFormat), processedSize); #endif