summaryrefslogtreecommitdiffstats
path: root/src/common/scratch_buffer.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-05-11 16:45:59 +0200
committerGitHub <noreply@github.com>2023-05-11 16:45:59 +0200
commit182221b9ffdee68c0f8c3749868918799f5b3d0f (patch)
tree53197c7461115b3f7c4855353356bd1a5ba17a0f /src/common/scratch_buffer.h
parentMerge pull request #10216 from Kelebek1/buffer_cache_region_checks (diff)
parentAllow Fermi blit accelerate to add src/dst to the cache if they don't exist already. Use ScratchBuffers in the software blit path. (diff)
downloadyuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar.gz
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar.bz2
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar.lz
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar.xz
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.tar.zst
yuzu-182221b9ffdee68c0f8c3749868918799f5b3d0f.zip
Diffstat (limited to 'src/common/scratch_buffer.h')
-rw-r--r--src/common/scratch_buffer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h
index 26d4e76dc..a69a5a7af 100644
--- a/src/common/scratch_buffer.h
+++ b/src/common/scratch_buffer.h
@@ -23,7 +23,10 @@ public:
buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {}
~ScratchBuffer() = default;
+ ScratchBuffer(const ScratchBuffer&) = delete;
+ ScratchBuffer& operator=(const ScratchBuffer&) = delete;
ScratchBuffer(ScratchBuffer&&) = default;
+ ScratchBuffer& operator=(ScratchBuffer&&) = default;
/// This will only grow the buffer's capacity if size is greater than the current capacity.
/// The previously held data will remain intact.
@@ -87,6 +90,12 @@ public:
return buffer_capacity;
}
+ void swap(ScratchBuffer& other) noexcept {
+ std::swap(last_requested_size, other.last_requested_size);
+ std::swap(buffer_capacity, other.buffer_capacity);
+ std::swap(buffer, other.buffer);
+ }
+
private:
size_t last_requested_size{};
size_t buffer_capacity{};