mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 16:01:52 +01:00
Avoid megabuffering buffers larger than the chunk size
This commit is contained in:
parent
b6f49884b3
commit
e0bc0d3a97
@ -330,7 +330,7 @@ namespace skyline::gpu {
|
||||
|
||||
BufferBinding Buffer::TryMegaBufferView(const std::shared_ptr<FenceCycle> &pCycle, MegaBufferAllocator &allocator, u32 executionNumber,
|
||||
vk::DeviceSize offset, vk::DeviceSize size) {
|
||||
if (!everHadInlineUpdate && sequenceNumber < FrequentlySyncedThreshold)
|
||||
if ((!everHadInlineUpdate && sequenceNumber < FrequentlySyncedThreshold) || size >= MegaBufferChunkSize)
|
||||
// Don't megabuffer buffers that have never had inline updates and are not frequently synced since performance is only going to be harmed as a result of the constant copying and there wont be any benefit since there are no GPU inline updates that would be avoided
|
||||
return {};
|
||||
|
||||
@ -346,7 +346,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
// If more than half the buffer has been megabuffered in chunks within the same execution assume this will generally be the case for this buffer and just megabuffer the whole thing without chunking
|
||||
if (unifiedMegaBufferEnabled || megaBufferViewAccumulatedSize > (backing.size() / 2)) {
|
||||
if (unifiedMegaBufferEnabled || (megaBufferViewAccumulatedSize > (backing.size() / 2) && backing.size() < MegaBufferChunkSize)) {
|
||||
if (!unifiedMegaBuffer) {
|
||||
unifiedMegaBuffer = allocator.Push(pCycle, mirror, true);
|
||||
unifiedMegaBufferEnabled = true;
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "megabuffer.h"
|
||||
|
||||
namespace skyline::gpu {
|
||||
constexpr static vk::DeviceSize MegaBufferChunkSize{25 * 1024 * 1024}; //!< Size in bytes of a single megabuffer chunk (25MiB)
|
||||
|
||||
MegaBufferChunk::MegaBufferChunk(GPU &gpu) : backing{gpu.memory.AllocateBuffer(MegaBufferChunkSize)}, freeRegion{backing.subspan(PAGE_SIZE)} {}
|
||||
|
||||
bool MegaBufferChunk::TryReset() {
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "memory_manager.h"
|
||||
|
||||
namespace skyline::gpu {
|
||||
constexpr static vk::DeviceSize MegaBufferChunkSize{25 * 1024 * 1024}; //!< Size in bytes of a single megabuffer chunk (25MiB)
|
||||
|
||||
/**
|
||||
* @brief A simple linearly allocated GPU-side buffer used to temporarily store buffer modifications allowing them to be replayed in-sequence on the GPU
|
||||
* @note This class is **not** thread-safe and any calls must be externally synchronized
|
||||
|
Loading…
Reference in New Issue
Block a user