diff options
| author | ash!! <346549+lynlevenick@users.noreply.github.com> | 2021-04-14 10:29:06 -0700 |
|---|---|---|
| committer | ash!! <346549+lynlevenick@users.noreply.github.com> | 2021-04-18 13:40:42 -0700 |
| commit | 43ceba4fef168a948cb70fd669229a0f10edeced (patch) | |
| tree | 15938c7dfdfcbfd2dcec299dda7c3606d861894f /Source/Core/Common/ChunkFile.h | |
| parent | 14959a1087b05500c5704b59e7d694d941d4a5cf (diff) | |
optimize TextureCacheBase::SerializeTexture, ::DeserializeTexture
texture serialization and deserialization used to involve many memory
allocations and deallocations, along with many copies to and from
those allocations. avoid those by reserving a memory region inside the
output and writing there directly, skipping the allocation and copy to
an intermediate buffer entirely.
Diffstat (limited to 'Source/Core/Common/ChunkFile.h')
| -rw-r--r-- | Source/Core/Common/ChunkFile.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h index 10f276e595..3e556f5397 100644 --- a/Source/Core/Common/ChunkFile.h +++ b/Source/Core/Common/ChunkFile.h @@ -200,6 +200,16 @@ public: DoArray(arr, static_cast<u32>(N)); } + // The caller is required to inspect the mode of this PointerWrap + // and deal with the pointer returned from this function themself. + [[nodiscard]] u8* DoExternal(u32& count) + { + Do(count); + u8* current = *ptr; + *ptr += count; + return current; + } + void Do(Common::Flag& flag) { bool s = flag.IsSet(); |
