mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Limit the performance impact from freeing from the GPU buffer to 5 ms per frame
fixes #1416 this is a workaround until #1434 is implemented
This commit is contained in:
parent
1fbf5618b9
commit
e4840f7503
@ -1893,8 +1893,10 @@ pub fn LargeBuffer(comptime Entry: type) type { // MARK: LargerBuffer
|
||||
pub fn beginRender(self: *Self) void {
|
||||
self.activeFence += 1;
|
||||
if(self.activeFence == self.fences.len) self.activeFence = 0;
|
||||
for(self.fencedFreeLists[self.activeFence].items) |allocation| {
|
||||
const startTime = std.time.milliTimestamp();
|
||||
while(self.fencedFreeLists[self.activeFence].popOrNull()) |allocation| {
|
||||
self.finalFree(allocation);
|
||||
if(std.time.milliTimestamp() -% startTime > 5) break; // TODO: Remove after #1434
|
||||
}
|
||||
self.fencedFreeLists[self.activeFence].clearRetainingCapacity();
|
||||
_ = c.glClientWaitSync(self.fences[self.activeFence], 0, c.GL_TIMEOUT_IGNORED); // Make sure the render calls that accessed these parts of the buffer have finished.
|
||||
|
Loading…
x
Reference in New Issue
Block a user