Bug 92019 - Implement texture atlas for OpenGL
Summary: Implement texture atlas for OpenGL
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: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: VCL-OpenGL
  Show dependency treegraph
 
Reported: 2015-06-12 01:16 UTC by Markus Mohrhard
Modified: 2016-10-25 19:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Mohrhard 2015-06-12 01:16:52 UTC
Currently all OpenGL textures are uploaded as single textures. This leads to some problems in the long run as you get texture fragmentation and miss the chance to save expensive OpenGL calls.

Ideally we would use texture atlases that contain several textures and we would use the uv coordinates to select the correct texture.

In the beginning I think it would be good to start with fixed size texture atlases for the 16x16 textures (maybe also 24x24). Writing a texture atlas for these sizes should be a lot easier as they should fit nicely into power of 2 textures and you don't need to implement an algorithm to place the texture into the atlas.

A followup task might be to write some code to find out who is using these textures and if we can save some of the unnecessary calls by combining as many calls into the atlas as possible.

Some background information:

http://en.wikipedia.org/wiki/Texture_atlas
http://http.download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf

The starting point for this would be our OpenGLTexture class. Most likely you want to hide whether the implementation uses a normal texture or a texture atlas. So I would start by abstracting teh interface and provide two implementations for the interface.
Comment 1 Commit Notification 2015-08-26 09:37:35 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#92019 Use texture atlas for 16, 24, 32, 48, 64 px width images

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 2 Commit Notification 2015-08-26 13:53:41 UTC
Tomaž Vajngerl committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

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

tdf#92019 Use texture atlas for 16, 24, 32, 48, 64 px width images

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.
Comment 3 How can I remove my account? 2015-08-27 09:56:18 UTC
Resolved by Tomaž's commits, I hope.
Comment 4 Robinson Tryon (qubit) 2015-12-15 22:50:29 UTC Comment hidden (obsolete)
Comment 5 Robinson Tryon (qubit) 2016-02-18 16:37:03 UTC Comment hidden (obsolete)