Browse Source

make virtual buffer become an optional

eden-orbis-ps4
lizzie 2 months ago
parent
commit
1e3bd9b852
  1. 2
      src/common/host_memory.cpp
  2. 1
      src/common/host_memory.h
  3. 7
      src/common/virtual_buffer.h

2
src/common/host_memory.cpp

@ -713,7 +713,7 @@ private:
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_) : backing_size(backing_size_), virtual_size(virtual_size_) {
#ifdef __OPENORBIS__
LOG_WARNING(HW_Memory, "Platform doesn't support fastmem");
fallback_buffer = std::make_unique<Common::VirtualBuffer<u8>>(backing_size);
fallback_buffer.emplace(backing_size);
backing_base = fallback_buffer->data();
virtual_base = nullptr;
#else

1
src/common/host_memory.h

@ -7,6 +7,7 @@
#pragma once
#include <memory>
#include <optional>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/virtual_buffer.h"

7
src/common/virtual_buffer.h

@ -32,9 +32,10 @@ public:
VirtualBuffer(const VirtualBuffer&) = delete;
VirtualBuffer& operator=(const VirtualBuffer&) = delete;
VirtualBuffer(VirtualBuffer&& other) noexcept
: alloc_size{std::exchange(other.alloc_size, 0)}, base_ptr{std::exchange(other.base_ptr),
nullptr} {}
VirtualBuffer(VirtualBuffer&& other) noexcept {
alloc_size = std::exchange(other.alloc_size, 0);
base_ptr = std::exchange(other.base_ptr, nullptr);
}
VirtualBuffer& operator=(VirtualBuffer&& other) noexcept {
alloc_size = std::exchange(other.alloc_size, 0);

Loading…
Cancel
Save