Bug Hunting Session
Bug 93751 - GL textures destroyed while still bound to framebuffers
Summary: GL textures destroyed while still bound to framebuffers
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0 target:5.0.2
Keywords:
Depends on:
Blocks: VCL-OpenGL
  Show dependency treegraph
 
Reported: 2015-08-28 21:29 UTC by Michael Meeks
Modified: 2016-10-25 19:24 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
assertion patch, with a potential workaround for 1x failure. (4.13 KB, patch)
2015-08-28 21:33 UTC, Michael Meeks
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2015-08-28 21:29:59 UTC
This is clearly incorrect; not least because we then re-allocate a texture with the same handle and try to bind it to the same frame-buffer and get:

void OpenGLFramebuffer::AttachTexture( const OpenGLTexture& rTexture )
{
    if( rTexture.Id() == mnAttachedTexture )
        return;

no binding, and then various unpleasant gl errors from trying to render to a FBO not bound to a valid texture such as GL_INVALID_FRAMEBUFFER_OPERATION ... which can't be good for the rendering stack.
Comment 1 Michael Meeks 2015-08-28 21:31:47 UTC
Been poking at this. Added a nice DBG_UTIL assert as attached - and started to try to knobble a few of these. Amazingly working quite nicely on Linux / -5-0 but Windows/master asserts pretty quickly. More amazingly, unbinding the FBO in the ~GdiImpl then gives a number of 'black' areas which (I guess) are not setup right in the status bar. Odd.
Comment 2 Michael Meeks 2015-08-28 21:33:08 UTC
Created attachment 118247 [details]
assertion patch, with a potential workaround for 1x failure.

I suspect that a more elegant way is to associate the texture and the framebuffer together with a mutual pointer so they can dis-associated each other on death etc. Of course - maintaining mutual pointers reliably is fun ;-)
Comment 3 Commit Notification 2015-08-31 19:09:40 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=18dd07ba4fd9ede98ce576e6024831658bbd5401

tdf#93751 - ensure textures are unbound from framebuffers post destroy.

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2015-09-01 07:42:11 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0a3cfc66d5c82e5c44ef5220bdbe4344b9d1e2ce&h=libreoffice-5-0

tdf#93751 - ensure textures are unbound from framebuffers post destroy.

It will be available in 5.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.