mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 03:29:43 -10:00
gl2: a page switch does not delete the overlay pack's textures
On the GL driver, rotating an Android device turned the on-screen
overlay into semi-transparent black boxes that stayed until the core
was restarted (reported by parkerlreed, Galaxy Fold, Adreno 840,
GLES 2 context, threaded video off).
Since df4b5a7e0b a page of the overlay is handed to the driver as the
pack's own texture names (load_textures). gl2_overlay_alloc() marks
such a page GL2_FLAG_OVERLAY_BORROWED - and nothing ever read the
flag. gl2_free_overlay() runs at the top of every page load and called
glDeleteTextures() on whatever names the previous page held, so the
first page switch deleted the pack's textures. A rotation is a page
switch (landscape to portrait and back), most names are on both pages,
and the pack - still cached, still sure it has its textures - went on
handing out dead names: an unbound texture samples as black, the
overlay's alpha does the rest. gl3, d3d11, d3d12 and vulkan honour
their marker; gl2 alone did not.
gl2_free_overlay() now deletes only names the driver made itself
(load()), and clears the flag so the next such page is not leaked.
This commit is contained in:
1 parent
f7393f3cc6
commit
78fda8c573
1 file changed
+6
-1
+6
-1
@@ -2974,7 +2974,12 @@ bool gl2_load_luts(
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void gl2_free_overlay(gl2_t *gl)
|
||||
{
|
||||
glDeleteTextures(gl->overlays, gl->overlay_tex);
|
||||
/* A page shown through load_textures holds the pack's names, which
|
||||
* are the pack's to delete (input_overlay_release_textures) and are
|
||||
* on the pack's other pages as well. */
|
||||
if (gl->overlay_tex && !(gl->flags & GL2_FLAG_OVERLAY_BORROWED))
|
||||
glDeleteTextures(gl->overlays, gl->overlay_tex);
|
||||
gl->flags &= ~GL2_FLAG_OVERLAY_BORROWED;
|
||||
|
||||
/* The three coordinate arrays are views into the overlay_tex block. */
|
||||
free(gl->overlay_tex);
|
||||
|
||||
Reference in new issue
Block a user