-
Notifications
You must be signed in to change notification settings - Fork 53
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove implicit frame cleanup #156
Conversation
Thanks for the pr. I'm away at the moment so won't be able to review for a little while. |
Any updates? |
My holiday is going well thanks ;)
…On Fri, 14 Oct 2022, 12:52 Erik Schubert, ***@***.***> wrote:
Any updates?
—
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARZHVZWJ2C2RDDDLI4MLW3WDGFU3ANCNFSM6AAAAAAQ22QOEQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm back, thanks for waiting. My first thought for this is that I don't want to break current behaviour, but perhaps adding this in a non-breaking way would be ok. Like a new method However, thinking about it more I'm less sure this is the way to do multiple draws in a frame. Lets take a 2 draw example:
Issues:
The 2nd point can be addressed with code making the struct multi-draw aware. The 1st point not so much & I think one of the key advantages of this crate is fast re-drawing. AlternativeI did require multiple text draws when I made Robo Instructus. I used multiple The downside is they can't share a single glyph rasterization One thing that could improve this to allow multiple So overall, perhaps you could try using a |
Hey 👋, thanks for the super detailed reply. Appreciate it. I had the misconception that the When thinking about one I guess the takeaway is, that it will be beneficial to mention somewhere that |
Yeah I think you're right that the docs could be improved! Perhaps a section on multi-draw per frame something like this discussion?
Of course it's still better to use as few GlyphBrush/pipelines/draws as possible per frame. But that's generally true of draws anyway. So I wouldn't go as far as "one GlyphBrush per "text"", rather one GlyphBrush per draw & to multi-draw/multi-GlyphBrush only when necessary. |
May I ask where you think the expensive part of using multiple Certainly, the texture usage is somewhat inefficient. The content of vertex buffers have to be allocated anyway. The GPU pipeline should be sharable potentially (for the same TextureFormat, etc.). There will be more draw calls. Right now my understanding is like:
|
Yeah that sounds about right to me. Re-draws are very fast so having multiple draws with most re-drawing should also be fast. So I think the only real issue is each pipeline having it's own draw cache texture, and as I said before in some cases the pipelines would use different fonts/sizes anyway so even that isn't too bad. It's still generally true in graphics APIs that if you can bundle more things into less draws it's better. So use as many |
Currently glyph_brush assumes that all text to be rendered in a frame is queued and then drawn at once with a single draw call. The different renderer implementations provide these draw methods, which call
GlyphBrush::process_queued()
under the hood, which currently implicitly maintains the cache. Using one draw call for all text in a single frame may be unfeasible, e.g. rendering text with transparency and proper z-ordering or using multiple scissoring regions, which causes many cache cleanups and misses. By allowing the user to manually control the cache cleanup, that issue can be avoid.Resolves #128.