Browse Source

Text: ensure method call order in GlyphCacheGL::processedImage().

It worked correctly with local testing, but now I enabled llvmpipe for
(desktop) GL testing on the CI where it's compiled with GCC 4.8 and *of
course* image.release() gets called before image.size(), resulting in
empty image being produced.

I bet the same happens with MSVC, it's just that nobody discovered yet.
pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
a85590dc71
  1. 6
      src/Magnum/Text/GlyphCacheGL.cpp

6
src/Magnum/Text/GlyphCacheGL.cpp

@ -193,7 +193,11 @@ void GlyphCacheGL::doSetProcessedImage(const Vector2i& offset, const ImageView2D
#ifndef MAGNUM_TARGET_GLES
Image3D GlyphCacheGL::doProcessedImage() {
Image2D out = static_cast<State&>(*_state).texture.image(0, processedFormat());
return Image3D{out.format(), {out.size(), 1}, out.release()};
/* Explicitly query size before calling release() to ensure the compiler
doesn't call first release() and then size() if they'd be in a single
expression, resulting in an image of zero dimensions */
const Vector3i size{out.size(), 1};
return Image3D{out.format(), size, out.release()};
}
#endif

Loading…
Cancel
Save