Only reallocate MegaBuffer on usage

Certain submissions might not utilize megabuffering but reserve a `MegaBuffer` regardless, this is not optimal since it can inflate the allocations and waste memory. This commit addresses the issue by eliding the allocation given the current submission doesn't utilize them.
This commit is contained in:
PixelyIon
2022-07-07 17:21:09 +05:30
parent 2366f81443
commit 7b209c54a2
3 changed files with 23 additions and 1 deletions

View File

@ -119,6 +119,14 @@ namespace skyline::gpu {
return *this;
}
bool MegaBuffer::WasUsed() {
return freeRegion != slot->backing.subspan(PAGE_SIZE);
}
void MegaBuffer::ReplaceCycle(const std::shared_ptr<FenceCycle> &cycle) {
slot->cycle = cycle;
}
void MegaBuffer::Reset() {
freeRegion = slot->backing.subspan(PAGE_SIZE);
}