Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Replace HWBufferMap with a list and back pointers #99

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

paradust7
Copy link
Contributor

Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, looks like it works fine.

@lhofhansl
Copy link
Contributor

I find it hard to reason about whether HWBuffers are indeed released as soon as a mesh is not longer visible.
That was the crux of the original problem, HWBuffers would hang around for all cached meshes.

When the mesh's reference count is 0 that means the mesh is not visible?

@sfan5
Copy link
Member

sfan5 commented Apr 27, 2022

It doesn't depend on the visibility of meshes but uses the lifetime of the mesh buffer.
When a hardware buffer is added it keeps an extra reference to the mesh, then when the reference count of the mesh drops to 1 both the hardware buffer and the last reference to the mesh are dropped.

@lhofhansl
Copy link
Contributor

Thanks @sfan5 . So that means that each cached mesh will keep its HWBuffer around, instead of just the visible meshes?

In any case, I'll try it out when I get some time next.

@sfan5
Copy link
Member

sfan5 commented Apr 27, 2022

So that means that each cached mesh will keep its HWBuffer around, instead of just the visible meshes?

Yes. This doesn't sound like a problem to me since the unload timeout on the client will get rid of old data at some point.

@sfan5 sfan5 merged commit ba0396e into minetest:master Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HWBufferMap causes periods of low framerate and stutter
3 participants