Drop size restruction bypass for frequently synced buffers

In cases where large buffers are updated every draw this could seriously increase memory usage beyond 3GB in the megabuffer.
This commit is contained in:
Billy Laws 2022-10-30 16:06:44 +00:00
parent 1088ed514c
commit 1d83dadefb
2 changed files with 4 additions and 2 deletions

View File

@ -354,8 +354,10 @@ namespace skyline::gpu {
return BufferBinding{unifiedMegaBuffer.buffer, unifiedMegaBuffer.offset + offset, size};
}
if (size > MegaBufferingDisableThreshold && sequenceNumber < FrequentlySyncedThresholdHigh)
if (size > MegaBufferingDisableThreshold) {
megaBufferViewAccumulatedSize += size;
return {};
}
size_t entryIdx{offset >> megaBufferTableShift};
size_t bufferEntryOffset{entryIdx << megaBufferTableShift};
@ -409,6 +411,7 @@ namespace skyline::gpu {
void Buffer::unlock() {
tag = ContextTag{};
AllowAllBackingWrites();
lastExecutionNumber = 0;
mutex.unlock();
}

View File

@ -69,7 +69,6 @@ namespace skyline::gpu {
static constexpr u32 InitialSequenceNumber{1}; //!< Sequence number that all buffers start off with
static constexpr u32 FrequentlySyncedThreshold{6}; //!< Threshold for the sequence number after which the buffer is considered elegible for megabuffering
static constexpr u32 FrequentlySyncedThresholdHigh{16}; //!< Threshold for the sequence number after which the buffer is considered elegible for megabuffering irrespective of view size
u32 sequenceNumber{InitialSequenceNumber}; //!< Sequence number that is incremented after all modifications to the host side `backing` buffer, used to prevent redundant copies of the buffer being stored in the megabuffer by views
constexpr static vk::DeviceSize MegaBufferingDisableThreshold{1024 * 256}; //!< The threshold at which a view is considered to be too large to be megabuffered (256KiB)