mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-20 10:24:58 +00:00
video_core: Implement guest buffer manager (#373)
* video_core: Introduce buffer cache * video_core: Use multi level page table for caches * renderer_vulkan: Remove unused stream buffer * fix build * oops forgot optimize off
This commit is contained in:
parent
159be2c7f4
commit
381ba8c7a5
55 changed files with 2697 additions and 1039 deletions
|
@ -3,20 +3,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <boost/icl/split_interval_map.hpp>
|
||||
#include "common/enum.h"
|
||||
#include "common/singleton.h"
|
||||
#include "common/types.h"
|
||||
#include "core/address_space.h"
|
||||
#include "core/libraries/kernel/memory_management.h"
|
||||
#include "video_core/renderer_vulkan/vk_common.h"
|
||||
|
||||
namespace Vulkan {
|
||||
class Instance;
|
||||
class Rasterizer;
|
||||
}
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
@ -128,8 +125,8 @@ public:
|
|||
explicit MemoryManager();
|
||||
~MemoryManager();
|
||||
|
||||
void SetInstance(const Vulkan::Instance* instance_) {
|
||||
instance = instance_;
|
||||
void SetRasterizer(Vulkan::Rasterizer* rasterizer_) {
|
||||
rasterizer = rasterizer_;
|
||||
}
|
||||
|
||||
void SetTotalFlexibleSize(u64 size) {
|
||||
|
@ -140,9 +137,7 @@ public:
|
|||
return total_flexible_size - flexible_usage;
|
||||
}
|
||||
|
||||
/// Returns the offset of the mapped virtual system managed memory base from where it usually
|
||||
/// would be mapped.
|
||||
[[nodiscard]] VAddr SystemReservedVirtualBase() noexcept {
|
||||
VAddr SystemReservedVirtualBase() noexcept {
|
||||
return impl.SystemReservedVirtualBase();
|
||||
}
|
||||
|
||||
|
@ -172,8 +167,6 @@ public:
|
|||
int DirectQueryAvailable(PAddr search_start, PAddr search_end, size_t alignment,
|
||||
PAddr* phys_addr_out, size_t* size_out);
|
||||
|
||||
std::pair<vk::Buffer, size_t> GetVulkanBuffer(VAddr addr);
|
||||
|
||||
int GetDirectMemoryType(PAddr addr, int* directMemoryTypeOut, void** directMemoryStartOut,
|
||||
void** directMemoryEndOut);
|
||||
|
||||
|
@ -218,10 +211,6 @@ private:
|
|||
|
||||
DMemHandle Split(DMemHandle dmem_handle, size_t offset_in_area);
|
||||
|
||||
void MapVulkanMemory(VAddr addr, size_t size);
|
||||
|
||||
void UnmapVulkanMemory(VAddr addr, size_t size);
|
||||
|
||||
private:
|
||||
AddressSpace impl;
|
||||
DMemMap dmem_map;
|
||||
|
@ -229,14 +218,7 @@ private:
|
|||
std::recursive_mutex mutex;
|
||||
size_t total_flexible_size = 448_MB;
|
||||
size_t flexible_usage{};
|
||||
|
||||
struct MappedMemory {
|
||||
vk::UniqueBuffer buffer;
|
||||
vk::UniqueDeviceMemory backing;
|
||||
size_t buffer_size;
|
||||
};
|
||||
std::map<VAddr, MappedMemory> mapped_memories;
|
||||
const Vulkan::Instance* instance{};
|
||||
Vulkan::Rasterizer* rasterizer{};
|
||||
};
|
||||
|
||||
using Memory = Common::Singleton<MemoryManager>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue