Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default, min, max atlas size to be specified #7

Open
grovesNL opened this issue May 11, 2022 · 4 comments
Open

Allow default, min, max atlas size to be specified #7

grovesNL opened this issue May 11, 2022 · 4 comments

Comments

@grovesNL
Copy link
Owner

No description provided.

@grovesNL grovesNL changed the title Allow specifying default, min, max atlas size Allow default, min, max atlas size to be specified May 11, 2022
@genusistimelord
Copy link
Contributor

This should also include limitations based on the System. You can get these lower and higher limitations from WGPU. You do not want to allow sizes that are below or above the systems sizes max/min. Generally since it is not super important end user side it would be best to preset this to the max texture size that the System would support. As you will need all the space you can get for Glyphs. Unicode along without storing different sizes of glyph's can kill the texture pretty fast.

@Nuckal777
Copy link

I have played around with dynamically growing the texture atlas. There is two ways to do this:

  1. Allocate a larger texture, drop glyph_cache, packer and texture_pending and rerasterize/reupload every currently required glyph (run prepare again).
  2. Allocate a larger texture, do a texture to texture copy using wgpu::CommandEncoder and extend texture_pending and packer. etageres Allocators don't support growing, though. Alternatively, this crate provides a growable atlas.

If you can tell me, which approach would be preferred, I am happy to drop by a PR.

@genusistimelord
Copy link
Contributor

genusistimelord commented Nov 15, 2022

I find its generally better to have a Texture array for each of the textures starting out at their max size of what is supported by hardware. Then using guillotiere to tell me if we need another layer or not. In my own project this is how i do it as this avoids resizing and allows dynamically growing within needed space. Also prevents you from over drafting the texture sizes on devices that don't support it.

@grovesNL
Copy link
Owner Author

A growable atlas is being implemented in #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants