Open DGriffin91 opened 1 month ago
It seems to maybe be related to merging passes. If I always return false
from https://github.com/attackgoat/screen-13/blob/bdc4a819ba44be7d337a839f4ec0d180f0594076/src/graph/resolver.rs#L175 this issues seems not to occur.
It seems like there is some kind of leak with the display pool. I haven't made a minimum reproducible example yet as I'm not sure exactly what's causing it yet. It still happens if I disable almost all of my passes except the main opaque pass, that's the furthest I've reduced the problem to so far. It seems to scale with the number of sub passes (leaks faster). It seems that it also causes this https://github.com/attackgoat/screen-13/blob/bdc4a819ba44be7d337a839f4ec0d180f0594076/src/graph/resolver.rs#L614 to take more time each frame. It seems like
cmd_begin_render_pass
is taking longer each frame for every pass as well, not just the opaque one (like the blit to swap will also take longer). Eventually it can take over 1ms (at the start it takes around 2us).Using https://crates.io/crates/leak-detect-allocator I found 4 additional instances of this showing up each frame:
I noticed that if I did an early submit before the swap, both the memory leak and the additional time spent per frame issue went away.
graph.resolve().submit(&mut LazyPool::new(&render_state.device), 0, 0).unwrap();
Then I tried just resetting the display pool before
display.resolve_image
and that also seemed to resolve the issue:display.pool = Box::new(HashPool::new(&render_state.device));
Resizing the window also seems to reset the issue with the additional time spent each frame, but doesn't seem to free the leaked memory.