1
0
Fork 0
forked from suyu/suyu

renderer_vulkan: Rename Vulkan memory manager to memory allocator

"Memory manager" collides with the guest GPU memory manager, and a
memory allocator sounds closer to what the abstraction aims to be.
This commit is contained in:
ReinUsesLisp 2021-01-03 18:11:01 -03:00
parent e996f1ad09
commit c2b550987b
15 changed files with 52 additions and 54 deletions

View file

@ -137,7 +137,7 @@ bool RendererVulkan::Init() try {
InitializeDevice(); InitializeDevice();
Report(); Report();
memory_manager = std::make_unique<VKMemoryManager>(*device); memory_allocator = std::make_unique<MemoryAllocator>(*device);
state_tracker = std::make_unique<StateTracker>(gpu); state_tracker = std::make_unique<StateTracker>(gpu);
@ -149,11 +149,11 @@ bool RendererVulkan::Init() try {
rasterizer = std::make_unique<RasterizerVulkan>(render_window, gpu, gpu.MemoryManager(), rasterizer = std::make_unique<RasterizerVulkan>(render_window, gpu, gpu.MemoryManager(),
cpu_memory, screen_info, *device, cpu_memory, screen_info, *device,
*memory_manager, *state_tracker, *scheduler); *memory_allocator, *state_tracker, *scheduler);
blit_screen = blit_screen =
std::make_unique<VKBlitScreen>(cpu_memory, render_window, *rasterizer, *device, std::make_unique<VKBlitScreen>(cpu_memory, render_window, *rasterizer, *device,
*memory_manager, *swapchain, *scheduler, screen_info); *memory_allocator, *swapchain, *scheduler, screen_info);
return true; return true;
} catch (const vk::Exception& exception) { } catch (const vk::Exception& exception) {
@ -172,7 +172,7 @@ void RendererVulkan::ShutDown() {
blit_screen.reset(); blit_screen.reset();
scheduler.reset(); scheduler.reset();
swapchain.reset(); swapchain.reset();
memory_manager.reset(); memory_allocator.reset();
device.reset(); device.reset();
} }

View file

@ -29,8 +29,8 @@ namespace Vulkan {
class Device; class Device;
class StateTracker; class StateTracker;
class MemoryAllocator;
class VKBlitScreen; class VKBlitScreen;
class VKMemoryManager;
class VKSwapchain; class VKSwapchain;
class VKScheduler; class VKScheduler;
@ -75,7 +75,7 @@ private:
vk::DebugUtilsMessenger debug_callback; vk::DebugUtilsMessenger debug_callback;
std::unique_ptr<Device> device; std::unique_ptr<Device> device;
std::unique_ptr<VKMemoryManager> memory_manager; std::unique_ptr<MemoryAllocator> memory_allocator;
std::unique_ptr<StateTracker> state_tracker; std::unique_ptr<StateTracker> state_tracker;
std::unique_ptr<VKScheduler> scheduler; std::unique_ptr<VKScheduler> scheduler;
std::unique_ptr<VKSwapchain> swapchain; std::unique_ptr<VKSwapchain> swapchain;

View file

@ -115,10 +115,10 @@ struct VKBlitScreen::BufferData {
VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_, VKBlitScreen::VKBlitScreen(Core::Memory::Memory& cpu_memory_,
Core::Frontend::EmuWindow& render_window_, Core::Frontend::EmuWindow& render_window_,
VideoCore::RasterizerInterface& rasterizer_, const Device& device_, VideoCore::RasterizerInterface& rasterizer_, const Device& device_,
VKMemoryManager& memory_manager_, VKSwapchain& swapchain_, MemoryAllocator& memory_allocator_, VKSwapchain& swapchain_,
VKScheduler& scheduler_, const VKScreenInfo& screen_info_) VKScheduler& scheduler_, const VKScreenInfo& screen_info_)
: cpu_memory{cpu_memory_}, render_window{render_window_}, rasterizer{rasterizer_}, : cpu_memory{cpu_memory_}, render_window{render_window_}, rasterizer{rasterizer_},
device{device_}, memory_manager{memory_manager_}, swapchain{swapchain_}, device{device_}, memory_allocator{memory_allocator_}, swapchain{swapchain_},
scheduler{scheduler_}, image_count{swapchain.GetImageCount()}, screen_info{screen_info_} { scheduler{scheduler_}, image_count{swapchain.GetImageCount()}, screen_info{screen_info_} {
resource_ticks.resize(image_count); resource_ticks.resize(image_count);
@ -657,7 +657,7 @@ void VKBlitScreen::CreateStagingBuffer(const Tegra::FramebufferConfig& framebuff
}; };
buffer = device.GetLogical().CreateBuffer(ci); buffer = device.GetLogical().CreateBuffer(ci);
buffer_commit = memory_manager.Commit(buffer, true); buffer_commit = memory_allocator.Commit(buffer, true);
} }
void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) { void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer) {
@ -688,7 +688,7 @@ void VKBlitScreen::CreateRawImages(const Tegra::FramebufferConfig& framebuffer)
.pQueueFamilyIndices = nullptr, .pQueueFamilyIndices = nullptr,
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED, .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
}); });
raw_buffer_commits[i] = memory_manager.Commit(raw_images[i], false); raw_buffer_commits[i] = memory_allocator.Commit(raw_images[i], false);
raw_image_views[i] = device.GetLogical().CreateImageView(VkImageViewCreateInfo{ raw_image_views[i] = device.GetLogical().CreateImageView(VkImageViewCreateInfo{
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,

View file

@ -43,7 +43,7 @@ public:
explicit VKBlitScreen(Core::Memory::Memory& cpu_memory, explicit VKBlitScreen(Core::Memory::Memory& cpu_memory,
Core::Frontend::EmuWindow& render_window, Core::Frontend::EmuWindow& render_window,
VideoCore::RasterizerInterface& rasterizer, const Device& device, VideoCore::RasterizerInterface& rasterizer, const Device& device,
VKMemoryManager& memory_manager, VKSwapchain& swapchain, MemoryAllocator& memory_allocator, VKSwapchain& swapchain,
VKScheduler& scheduler, const VKScreenInfo& screen_info); VKScheduler& scheduler, const VKScreenInfo& screen_info);
~VKBlitScreen(); ~VKBlitScreen();
@ -86,7 +86,7 @@ private:
Core::Frontend::EmuWindow& render_window; Core::Frontend::EmuWindow& render_window;
VideoCore::RasterizerInterface& rasterizer; VideoCore::RasterizerInterface& rasterizer;
const Device& device; const Device& device;
VKMemoryManager& memory_manager; MemoryAllocator& memory_allocator;
VKSwapchain& swapchain; VKSwapchain& swapchain;
VKScheduler& scheduler; VKScheduler& scheduler;
const std::size_t image_count; const std::size_t image_count;

View file

@ -36,7 +36,7 @@ constexpr VkAccessFlags TRANSFORM_FEEDBACK_WRITE_ACCESS =
} // Anonymous namespace } // Anonymous namespace
Buffer::Buffer(const Device& device_, VKMemoryManager& memory_manager, VKScheduler& scheduler_, Buffer::Buffer(const Device& device_, MemoryAllocator& memory_allocator, VKScheduler& scheduler_,
StagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_) StagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_)
: BufferBlock{cpu_addr_, size_}, device{device_}, scheduler{scheduler_}, staging_pool{ : BufferBlock{cpu_addr_, size_}, device{device_}, scheduler{scheduler_}, staging_pool{
staging_pool_} { staging_pool_} {
@ -50,7 +50,7 @@ Buffer::Buffer(const Device& device_, VKMemoryManager& memory_manager, VKSchedul
.queueFamilyIndexCount = 0, .queueFamilyIndexCount = 0,
.pQueueFamilyIndices = nullptr, .pQueueFamilyIndices = nullptr,
}); });
commit = memory_manager.Commit(buffer, false); commit = memory_allocator.Commit(buffer, false);
} }
Buffer::~Buffer() = default; Buffer::~Buffer() = default;
@ -162,18 +162,18 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst
VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_, VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const Device& device_, VKMemoryManager& memory_manager_, const Device& device_, MemoryAllocator& memory_allocator_,
VKScheduler& scheduler_, VKStreamBuffer& stream_buffer_, VKScheduler& scheduler_, VKStreamBuffer& stream_buffer_,
StagingBufferPool& staging_pool_) StagingBufferPool& staging_pool_)
: VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer_, gpu_memory_, : VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer_, gpu_memory_,
cpu_memory_, stream_buffer_}, cpu_memory_, stream_buffer_},
device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_},
staging_pool_} {} staging_pool{staging_pool_} {}
VKBufferCache::~VKBufferCache() = default; VKBufferCache::~VKBufferCache() = default;
std::shared_ptr<Buffer> VKBufferCache::CreateBlock(VAddr cpu_addr, std::size_t size) { std::shared_ptr<Buffer> VKBufferCache::CreateBlock(VAddr cpu_addr, std::size_t size) {
return std::make_shared<Buffer>(device, memory_manager, scheduler, staging_pool, cpu_addr, return std::make_shared<Buffer>(device, memory_allocator, scheduler, staging_pool, cpu_addr,
size); size);
} }

View file

@ -10,7 +10,6 @@
#include "video_core/buffer_cache/buffer_cache.h" #include "video_core/buffer_cache/buffer_cache.h"
#include "video_core/renderer_vulkan/vk_memory_manager.h" #include "video_core/renderer_vulkan/vk_memory_manager.h"
#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h"
#include "video_core/renderer_vulkan/vk_memory_manager.h"
#include "video_core/renderer_vulkan/vk_stream_buffer.h" #include "video_core/renderer_vulkan/vk_stream_buffer.h"
#include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/vulkan_common/vulkan_wrapper.h"
@ -21,7 +20,7 @@ class VKScheduler;
class Buffer final : public VideoCommon::BufferBlock { class Buffer final : public VideoCommon::BufferBlock {
public: public:
explicit Buffer(const Device& device, VKMemoryManager& memory_manager, VKScheduler& scheduler, explicit Buffer(const Device& device, MemoryAllocator& memory_allocator, VKScheduler& scheduler,
StagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_); StagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_);
~Buffer(); ~Buffer();
@ -53,7 +52,7 @@ class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VK
public: public:
explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer, explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory,
const Device& device, VKMemoryManager& memory_manager, const Device& device, MemoryAllocator& memory_allocator,
VKScheduler& scheduler, VKStreamBuffer& stream_buffer, VKScheduler& scheduler, VKStreamBuffer& stream_buffer,
StagingBufferPool& staging_pool); StagingBufferPool& staging_pool);
~VKBufferCache(); ~VKBufferCache();
@ -65,7 +64,7 @@ protected:
private: private:
const Device& device; const Device& device;
VKMemoryManager& memory_manager; MemoryAllocator& memory_allocator;
VKScheduler& scheduler; VKScheduler& scheduler;
StagingBufferPool& staging_pool; StagingBufferPool& staging_pool;
}; };

View file

@ -60,8 +60,7 @@ private:
class Uint8Pass final : public VKComputePass { class Uint8Pass final : public VKComputePass {
public: public:
explicit Uint8Pass(const Device& device_, VKScheduler& scheduler_, explicit Uint8Pass(const Device& device_, VKScheduler& scheduler_,
VKDescriptorPool& descriptor_pool_, VKDescriptorPool& descriptor_pool_, StagingBufferPool& staging_buffer_pool_,
StagingBufferPool& staging_buffer_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_); VKUpdateDescriptorQueue& update_descriptor_queue_);
~Uint8Pass(); ~Uint8Pass();

View file

@ -151,12 +151,12 @@ void MemoryCommit::Release() {
} }
} }
VKMemoryManager::VKMemoryManager(const Device& device_) MemoryAllocator::MemoryAllocator(const Device& device_)
: device{device_}, properties{device_.GetPhysical().GetMemoryProperties()} {} : device{device_}, properties{device_.GetPhysical().GetMemoryProperties()} {}
VKMemoryManager::~VKMemoryManager() = default; MemoryAllocator::~MemoryAllocator() = default;
MemoryCommit VKMemoryManager::Commit(const VkMemoryRequirements& requirements, bool host_visible) { MemoryCommit MemoryAllocator::Commit(const VkMemoryRequirements& requirements, bool host_visible) {
const u64 chunk_size = GetAllocationChunkSize(requirements.size); const u64 chunk_size = GetAllocationChunkSize(requirements.size);
// When a host visible commit is asked, search for host visible and coherent, otherwise search // When a host visible commit is asked, search for host visible and coherent, otherwise search
@ -176,19 +176,19 @@ MemoryCommit VKMemoryManager::Commit(const VkMemoryRequirements& requirements, b
return TryAllocCommit(requirements, wanted_properties).value(); return TryAllocCommit(requirements, wanted_properties).value();
} }
MemoryCommit VKMemoryManager::Commit(const vk::Buffer& buffer, bool host_visible) { MemoryCommit MemoryAllocator::Commit(const vk::Buffer& buffer, bool host_visible) {
auto commit = Commit(device.GetLogical().GetBufferMemoryRequirements(*buffer), host_visible); auto commit = Commit(device.GetLogical().GetBufferMemoryRequirements(*buffer), host_visible);
buffer.BindMemory(commit.Memory(), commit.Offset()); buffer.BindMemory(commit.Memory(), commit.Offset());
return commit; return commit;
} }
MemoryCommit VKMemoryManager::Commit(const vk::Image& image, bool host_visible) { MemoryCommit MemoryAllocator::Commit(const vk::Image& image, bool host_visible) {
auto commit = Commit(device.GetLogical().GetImageMemoryRequirements(*image), host_visible); auto commit = Commit(device.GetLogical().GetImageMemoryRequirements(*image), host_visible);
image.BindMemory(commit.Memory(), commit.Offset()); image.BindMemory(commit.Memory(), commit.Offset());
return commit; return commit;
} }
void VKMemoryManager::AllocMemory(VkMemoryPropertyFlags wanted_properties, u32 type_mask, void MemoryAllocator::AllocMemory(VkMemoryPropertyFlags wanted_properties, u32 type_mask,
u64 size) { u64 size) {
const u32 type = [&] { const u32 type = [&] {
for (u32 type_index = 0; type_index < properties.memoryTypeCount; ++type_index) { for (u32 type_index = 0; type_index < properties.memoryTypeCount; ++type_index) {
@ -211,7 +211,7 @@ void VKMemoryManager::AllocMemory(VkMemoryPropertyFlags wanted_properties, u32 t
wanted_properties, size, type)); wanted_properties, size, type));
} }
std::optional<MemoryCommit> VKMemoryManager::TryAllocCommit( std::optional<MemoryCommit> MemoryAllocator::TryAllocCommit(
const VkMemoryRequirements& requirements, VkMemoryPropertyFlags wanted_properties) { const VkMemoryRequirements& requirements, VkMemoryPropertyFlags wanted_properties) {
for (auto& allocation : allocations) { for (auto& allocation : allocations) {
if (!allocation->IsCompatible(wanted_properties, requirements.memoryTypeBits)) { if (!allocation->IsCompatible(wanted_properties, requirements.memoryTypeBits)) {

View file

@ -54,13 +54,13 @@ private:
std::span<u8> span; ///< Host visible memory span. Empty if not queried before. std::span<u8> span; ///< Host visible memory span. Empty if not queried before.
}; };
class VKMemoryManager final { class MemoryAllocator final {
public: public:
explicit VKMemoryManager(const Device& device_); explicit MemoryAllocator(const Device& device_);
~VKMemoryManager(); ~MemoryAllocator();
VKMemoryManager& operator=(const VKMemoryManager&) = delete; MemoryAllocator& operator=(const MemoryAllocator&) = delete;
VKMemoryManager(const VKMemoryManager&) = delete; MemoryAllocator(const MemoryAllocator&) = delete;
/** /**
* Commits a memory with the specified requeriments. * Commits a memory with the specified requeriments.

View file

@ -409,24 +409,24 @@ void RasterizerVulkan::DrawParameters::Draw(vk::CommandBuffer cmdbuf) const {
RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_, Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_,
const Device& device_, VKMemoryManager& memory_manager_, const Device& device_, MemoryAllocator& memory_allocator_,
StateTracker& state_tracker_, VKScheduler& scheduler_) StateTracker& state_tracker_, VKScheduler& scheduler_)
: RasterizerAccelerated{cpu_memory_}, gpu{gpu_}, : RasterizerAccelerated{cpu_memory_}, gpu{gpu_},
gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()}, gpu_memory{gpu_memory_}, maxwell3d{gpu.Maxwell3D()}, kepler_compute{gpu.KeplerCompute()},
screen_info{screen_info_}, device{device_}, memory_manager{memory_manager_}, screen_info{screen_info_}, device{device_}, memory_allocator{memory_allocator_},
state_tracker{state_tracker_}, scheduler{scheduler_}, stream_buffer(device, scheduler), state_tracker{state_tracker_}, scheduler{scheduler_}, stream_buffer(device, scheduler),
staging_pool(device, memory_manager, scheduler), descriptor_pool(device, scheduler), staging_pool(device, memory_allocator, scheduler), descriptor_pool(device, scheduler),
update_descriptor_queue(device, scheduler), update_descriptor_queue(device, scheduler),
blit_image(device, scheduler, state_tracker, descriptor_pool), blit_image(device, scheduler, state_tracker, descriptor_pool),
quad_array_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue), quad_array_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue),
quad_indexed_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue), quad_indexed_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue),
uint8_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue), uint8_pass(device, scheduler, descriptor_pool, staging_pool, update_descriptor_queue),
texture_cache_runtime{device, scheduler, memory_manager, staging_pool, blit_image}, texture_cache_runtime{device, scheduler, memory_allocator, staging_pool, blit_image},
texture_cache(texture_cache_runtime, *this, maxwell3d, kepler_compute, gpu_memory), texture_cache(texture_cache_runtime, *this, maxwell3d, kepler_compute, gpu_memory),
pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler, pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler,
descriptor_pool, update_descriptor_queue), descriptor_pool, update_descriptor_queue),
buffer_cache(*this, gpu_memory, cpu_memory_, device, memory_manager, scheduler, stream_buffer, buffer_cache(*this, gpu_memory, cpu_memory_, device, memory_allocator, scheduler,
staging_pool), stream_buffer, staging_pool),
query_cache{*this, maxwell3d, gpu_memory, device, scheduler}, query_cache{*this, maxwell3d, gpu_memory, device, scheduler},
fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, scheduler), fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, scheduler),
wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window_) { wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window_) {
@ -1445,7 +1445,7 @@ VkBuffer RasterizerVulkan::DefaultBuffer() {
.queueFamilyIndexCount = 0, .queueFamilyIndexCount = 0,
.pQueueFamilyIndices = nullptr, .pQueueFamilyIndices = nullptr,
}); });
default_buffer_commit = memory_manager.Commit(default_buffer, false); default_buffer_commit = memory_allocator.Commit(default_buffer, false);
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();
scheduler.Record([buffer = *default_buffer](vk::CommandBuffer cmdbuf) { scheduler.Record([buffer = *default_buffer](vk::CommandBuffer cmdbuf) {

View file

@ -56,7 +56,7 @@ public:
explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
VKScreenInfo& screen_info_, const Device& device_, VKScreenInfo& screen_info_, const Device& device_,
VKMemoryManager& memory_manager_, StateTracker& state_tracker_, MemoryAllocator& memory_allocator_, StateTracker& state_tracker_,
VKScheduler& scheduler_); VKScheduler& scheduler_);
~RasterizerVulkan() override; ~RasterizerVulkan() override;
@ -213,7 +213,7 @@ private:
VKScreenInfo& screen_info; VKScreenInfo& screen_info;
const Device& device; const Device& device;
VKMemoryManager& memory_manager; MemoryAllocator& memory_allocator;
StateTracker& state_tracker; StateTracker& state_tracker;
VKScheduler& scheduler; VKScheduler& scheduler;

View file

@ -12,14 +12,14 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "video_core/renderer_vulkan/vk_scheduler.h" #include "video_core/renderer_vulkan/vk_scheduler.h"
#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h"
#include "video_core/vulkan_common/vulkan_wrapper.h"
#include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_device.h"
#include "video_core/vulkan_common/vulkan_wrapper.h"
namespace Vulkan { namespace Vulkan {
StagingBufferPool::StagingBufferPool(const Device& device_, VKMemoryManager& memory_manager_, StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& memory_allocator_,
VKScheduler& scheduler_) VKScheduler& scheduler_)
: device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_} {} : device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_} {}
StagingBufferPool::~StagingBufferPool() = default; StagingBufferPool::~StagingBufferPool() = default;
@ -76,7 +76,7 @@ StagingBufferRef StagingBufferPool::CreateStagingBuffer(size_t size, bool host_v
++buffer_index; ++buffer_index;
buffer.SetObjectNameEXT(fmt::format("Staging Buffer {}", buffer_index).c_str()); buffer.SetObjectNameEXT(fmt::format("Staging Buffer {}", buffer_index).c_str());
} }
MemoryCommit commit = memory_manager.Commit(buffer, host_visible); MemoryCommit commit = memory_allocator.Commit(buffer, host_visible);
const std::span<u8> mapped_span = host_visible ? commit.Map() : std::span<u8>{}; const std::span<u8> mapped_span = host_visible ? commit.Map() : std::span<u8>{};
StagingBuffer& entry = GetCache(host_visible)[log2].entries.emplace_back(StagingBuffer{ StagingBuffer& entry = GetCache(host_visible)[log2].entries.emplace_back(StagingBuffer{

View file

@ -24,7 +24,7 @@ struct StagingBufferRef {
class StagingBufferPool { class StagingBufferPool {
public: public:
explicit StagingBufferPool(const Device& device, VKMemoryManager& memory_manager, explicit StagingBufferPool(const Device& device, MemoryAllocator& memory_allocator,
VKScheduler& scheduler); VKScheduler& scheduler);
~StagingBufferPool(); ~StagingBufferPool();
@ -67,7 +67,7 @@ private:
void ReleaseLevel(StagingBuffersCache& cache, size_t log2); void ReleaseLevel(StagingBuffersCache& cache, size_t log2);
const Device& device; const Device& device;
VKMemoryManager& memory_manager; MemoryAllocator& memory_allocator;
VKScheduler& scheduler; VKScheduler& scheduler;
StagingBuffersCache host_staging_buffers; StagingBuffersCache host_staging_buffers;

View file

@ -788,9 +788,9 @@ Image::Image(TextureCacheRuntime& runtime, const ImageInfo& info_, GPUVAddr gpu_
image(MakeImage(runtime.device, info)), buffer(MakeBuffer(runtime.device, info)), image(MakeImage(runtime.device, info)), buffer(MakeBuffer(runtime.device, info)),
aspect_mask(ImageAspectMask(info.format)) { aspect_mask(ImageAspectMask(info.format)) {
if (image) { if (image) {
commit = runtime.memory_manager.Commit(image, false); commit = runtime.memory_allocator.Commit(image, false);
} else { } else {
commit = runtime.memory_manager.Commit(buffer, false); commit = runtime.memory_allocator.Commit(buffer, false);
} }
if (IsPixelFormatASTC(info.format) && !runtime.device.IsOptimalAstcSupported()) { if (IsPixelFormatASTC(info.format) && !runtime.device.IsOptimalAstcSupported()) {
flags |= VideoCommon::ImageFlagBits::Converted; flags |= VideoCommon::ImageFlagBits::Converted;

View file

@ -69,7 +69,7 @@ struct ImageBufferMap {
struct TextureCacheRuntime { struct TextureCacheRuntime {
const Device& device; const Device& device;
VKScheduler& scheduler; VKScheduler& scheduler;
VKMemoryManager& memory_manager; MemoryAllocator& memory_allocator;
StagingBufferPool& staging_buffer_pool; StagingBufferPool& staging_buffer_pool;
BlitImageHelper& blit_image_helper; BlitImageHelper& blit_image_helper;
std::unordered_map<RenderPassKey, vk::RenderPass> renderpass_cache; std::unordered_map<RenderPassKey, vk::RenderPass> renderpass_cache;