Store the ImageInfo for font textures in the font#1030
Merged
robertosfield merged 1 commit intovsg-dev:masterfrom Nov 17, 2023
Merged
Store the ImageInfo for font textures in the font#1030robertosfield merged 1 commit intovsg-dev:masterfrom
robertosfield merged 1 commit intovsg-dev:masterfrom
Conversation
This is in place of only storing the Data for the font texture and relying on SharedObjects to find an already created font texture. The font glyph metrics weren't stored as data at all, but were recreated on every creation of a GpuLayoutTechnique. At the moment this change results in a massive memory savings in complex scenes. There seems to be a bug in SharedObjects in that it can't pick up the images in a font if they are recreated on each use, resulting in gigabytes of extra texture use. Even if SharedObjects is fixed, it is cleaner to store the images in the font. The glyph metrics texture should probably be a storage buffer instead.
Collaborator
|
Changes look good. It looks like createFontImages() is already created when needed, so what would the benefit of vsgXchange::freetype calling it explicitly? |
Contributor
Author
|
I was worried about multithreading issues and didn't want to add a mutex to the font or something, and so thought it best if the font-building code completely constructed the images. |
Collaborator
|
It is indeed safer to create as much up front before objects are shared to prevent possible race conditions. There remains an open ended question of how much of the compile and record traversals need objects protected to prevent race conditions, so far I have left it high level coordinates of threads to prevent them stepping on each others toes with shared data, but it's fragile peace. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is in place of only storing the Data for the font texture and relying on SharedObjects to find an already created font texture. The font glyph metrics weren't stored as data at all, but were recreated on every creation of a GpuLayoutTechnique.
At the moment this change results in a massive memory savings in complex scenes. There seems to be a bug in SharedObjects in that it can't pick up the images in a font if they are recreated on each use, resulting in gigabytes of extra texture use. Even if SharedObjects is fixed, it is cleaner to store the images in the font.
The glyph metrics texture should probably be a storage buffer instead.
If this is accepted, then the code in vsgXchange that creates a font using freetype should probably change to call createFontImages().