-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Use a StagingBelt
for regular buffer uploads
#92
base: main
Are you sure you want to change the base?
Conversation
font_system: &mut FontSystem, | ||
atlas: &mut TextAtlas, | ||
screen_resolution: Resolution, | ||
text_areas: impl IntoIterator<Item = TextArea<'a>>, | ||
cache: &mut SwashCache, | ||
mut metadata_to_depth: impl FnMut(usize) -> f32, | ||
) -> Result<(), PrepareError> { | ||
self.staging_belt.recall(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, for lowest memory usage recall
should be called right after the user submits the Queue
. But this approach removes the burden of a StagingBelt
from the user and keeps it hidden.
Worst case scenario, we allocate some additional chunks. Overhead should be constant.
self.staging_belt.finish(); | ||
self.staging_belt = StagingBelt::new(buffer_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, we only need to worry about resizing the belt when the vertex buffer grows, since index buffer uploads will never be bigger than the vertex ones.
6 u32
indices (6 * 4 bytes) are generated per each 4 GlyphToRender
vertices (4 * 18 bytes).
`Queue::write_buffer` allocates very regularly, specially on Metal. See: iced-rs/iced#2357 A `StagingBelt` gives us more control and predictability.
9172235
to
153a63b
Compare
I just rebased this onto |
Queue::write_buffer
allocates very regularly, specially on Metal.See: iced-rs/iced#2357
A
StagingBelt
gives us more control and predictability.