Browse Source

[TEST] Adjusments on deferred destruction implementation

temporary-branch
CamilleLaVey 5 days ago
parent
commit
aec20586be
  1. 1
      src/video_core/buffer_cache/buffer_cache_base.h
  2. 9
      src/video_core/deferred_destruction_queue.h
  3. 8
      src/video_core/renderer_vulkan/vk_update_descriptor.cpp
  4. 4
      src/video_core/renderer_vulkan/vk_update_descriptor.h
  5. 4
      src/video_core/texture_cache/texture_cache.h
  6. 4
      src/video_core/texture_cache/texture_cache_base.h

1
src/video_core/buffer_cache/buffer_cache_base.h

@ -9,6 +9,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <bit> #include <bit>
#include <deque>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <mutex> #include <mutex>

9
src/video_core/deferred_destruction_queue.h

@ -4,9 +4,11 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <deque>
#include <utility> #include <utility>
#include <boost/container/deque.hpp>
#include <boost/container/options.hpp>
#include "common/common_types.h" #include "common/common_types.h"
namespace VideoCommon { namespace VideoCommon {
@ -45,7 +47,10 @@ private:
u64 sync_point; u64 sync_point;
}; };
std::deque<Entry> entries;
using EntryDequeOptions =
boost::container::deque_options<boost::container::block_size<8u>>::type;
boost::container::deque<Entry, void, EntryDequeOptions> entries;
}; };
} // namespace VideoCommon } // namespace VideoCommon

8
src/video_core/renderer_vulkan/vk_update_descriptor.cpp

@ -18,10 +18,10 @@ namespace Vulkan {
UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_, size_t frame_payload_size_) UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_, size_t frame_payload_size_)
: device{device_}, frame_payload_size{frame_payload_size_}, : device{device_}, frame_payload_size{frame_payload_size_},
payload{std::make_unique<DescriptorUpdateEntry[]>(frame_payload_size_ * FRAMES_IN_FLIGHT)}
payload(frame_payload_size_ * FRAMES_IN_FLIGHT)
{ {
payload_start = payload.get();
payload_cursor = payload.get();
payload_start = payload.data();
payload_cursor = payload.data();
} }
UpdateDescriptorQueue::~UpdateDescriptorQueue() = default; UpdateDescriptorQueue::~UpdateDescriptorQueue() = default;
@ -30,7 +30,7 @@ void UpdateDescriptorQueue::TickFrame() {
if (++frame_index >= FRAMES_IN_FLIGHT) { if (++frame_index >= FRAMES_IN_FLIGHT) {
frame_index = 0; frame_index = 0;
} }
payload_start = payload.get() + frame_index * frame_payload_size;
payload_start = payload.data() + frame_index * frame_payload_size;
payload_cursor = payload_start; payload_cursor = payload_start;
} }

4
src/video_core/renderer_vulkan/vk_update_descriptor.h

@ -6,8 +6,8 @@
#pragma once #pragma once
#include <memory>
#include <variant> #include <variant>
#include <boost/container/small_vector.hpp>
#include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/vulkan_common/vulkan_wrapper.h"
namespace Vulkan { namespace Vulkan {
@ -80,7 +80,7 @@ private:
DescriptorUpdateEntry* payload_cursor = nullptr; DescriptorUpdateEntry* payload_cursor = nullptr;
DescriptorUpdateEntry* payload_start = nullptr; DescriptorUpdateEntry* payload_start = nullptr;
const DescriptorUpdateEntry* upload_start = nullptr; const DescriptorUpdateEntry* upload_start = nullptr;
std::unique_ptr<DescriptorUpdateEntry[]> payload;
boost::container::small_vector<DescriptorUpdateEntry, 0> payload;
}; };
// TODO: should these be separate classes instead? // TODO: should these be separate classes instead?

4
src/video_core/texture_cache/texture_cache.h

@ -107,9 +107,9 @@ void TextureCache<P>::QueueEvictionDownload(Image& image) {
pending_eviction_downloads.push_back(PendingEvictionDownload{ pending_eviction_downloads.push_back(PendingEvictionDownload{
.staging = staging, .staging = staging,
.gpu_memory = gpu_memory, .gpu_memory = gpu_memory,
.gpu_addr = image.gpu_addr,
.info = image.info,
.copies = std::move(copies), .copies = std::move(copies),
.info = image.info,
.gpu_addr = image.gpu_addr,
.sync_point = runtime.CurrentSyncPoint(), .sync_point = runtime.CurrentSyncPoint(),
}); });
} }

4
src/video_core/texture_cache/texture_cache_base.h

@ -513,9 +513,9 @@ private:
struct PendingEvictionDownload { struct PendingEvictionDownload {
AsyncBuffer staging; AsyncBuffer staging;
Tegra::MemoryManager* gpu_memory; Tegra::MemoryManager* gpu_memory;
GPUVAddr gpu_addr;
VideoCommon::ImageInfo info;
boost::container::small_vector<VideoCommon::BufferImageCopy, 16> copies; boost::container::small_vector<VideoCommon::BufferImageCopy, 16> copies;
VideoCommon::ImageInfo info;
GPUVAddr gpu_addr;
u64 sync_point; u64 sync_point;
}; };
std::deque<PendingEvictionDownload> pending_eviction_downloads; std::deque<PendingEvictionDownload> pending_eviction_downloads;

Loading…
Cancel
Save