Bug 1360 - TextRenderer doesn't flush drawn text to GPU when backing texture fills up, ends up drawing incorrect text later
Summary: TextRenderer doesn't flush drawn text to GPU when backing texture fills up, e...
Alias: None
Product: Jogl
Classification: JogAmp
Component: util (show other bugs)
Version: tbd
Hardware: All all
: P4 normal
Assignee: Sven Gothel
Depends on:
Reported: 2019-01-28 20:22 CET by Andy Edwards
Modified: 2019-03-29 13:58 CET (History)
0 users

See Also:
SCM Refs:
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Andy Edwards 2019-01-28 20:22:43 CET
I don't know for sure if this can happen, but based on my analysis of TextRenderer/GlyphCache/TextureBackingStoreManager/RectanglePacker it seems very likely.

It's possible to draw so many different characters within a single beginRendering()/endRendering() block that not even the maximum texture size could fit all of the glyphs.  Most of the drawn text will have already been flushed to the GPU because of the QuadRenderer filling up and automatically flushing, but the backing texture could fill up when the QuadRenderer is only half full.

When the glyph texture size is maxed out and it fills up, RectanglePacker calls manager.additionFailed, which fires a FAILURE event.  GlyphCache responds by clearing the cache and firing its own CLEAR event to TextRenderer, which only responds by calling glyphProducer.clearGlyphs().

The result is that any drawn text that hasn't been flushed to the GPU when the backing texture fills up won't get drawn properly.

To fix this, TextRenderer should flush() when the backing texture fills up, *before* the cache is cleared.