diff options
| author | 2024-02-03 22:51:04 +0100 | |
|---|---|---|
| committer | 2024-02-04 20:01:47 +0100 | |
| commit | 4841dc0b745389fb03edbf900f25511bee4b3d88 (patch) | |
| tree | 40149c44691369597dec8f126bab6bc1b808e93f /src/video_core | |
| parent | Merge pull request #12901 from Kelebek1/timezone_firmware_fix (diff) | |
| download | yuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.tar.gz yuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.tar.xz yuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.zip | |
VideoCore: Move Slot Vector to Common
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache_base.h | 6 | ||||
| -rw-r--r-- | src/video_core/query_cache.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 2 | ||||
| -rw-r--r-- | src/video_core/texture_cache/slot_vector.h | 227 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 18 | ||||
| -rw-r--r-- | src/video_core/texture_cache/types.h | 16 |
11 files changed, 28 insertions, 256 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 16c905db9..55180f4b5 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -274,7 +274,6 @@ add_library(video_core STATIC | |||
| 274 | texture_cache/image_view_info.h | 274 | texture_cache/image_view_info.h |
| 275 | texture_cache/render_targets.h | 275 | texture_cache/render_targets.h |
| 276 | texture_cache/samples_helper.h | 276 | texture_cache/samples_helper.h |
| 277 | texture_cache/slot_vector.h | ||
| 278 | texture_cache/texture_cache.cpp | 277 | texture_cache/texture_cache.cpp |
| 279 | texture_cache/texture_cache.h | 278 | texture_cache/texture_cache.h |
| 280 | texture_cache/texture_cache_base.h | 279 | texture_cache/texture_cache_base.h |
diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 80dbb81e7..59124458d 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | #include "video_core/engines/maxwell_3d.h" | 41 | #include "video_core/engines/maxwell_3d.h" |
| 42 | #include "video_core/memory_manager.h" | 42 | #include "video_core/memory_manager.h" |
| 43 | #include "video_core/surface.h" | 43 | #include "video_core/surface.h" |
| 44 | #include "video_core/texture_cache/slot_vector.h" | 44 | #include "common/slot_vector.h" |
| 45 | #include "video_core/texture_cache/types.h" | 45 | #include "video_core/texture_cache/types.h" |
| 46 | 46 | ||
| 47 | namespace boost { | 47 | namespace boost { |
| @@ -55,7 +55,7 @@ MICROPROFILE_DECLARE(GPU_PrepareBuffers); | |||
| 55 | MICROPROFILE_DECLARE(GPU_BindUploadBuffers); | 55 | MICROPROFILE_DECLARE(GPU_BindUploadBuffers); |
| 56 | MICROPROFILE_DECLARE(GPU_DownloadMemory); | 56 | MICROPROFILE_DECLARE(GPU_DownloadMemory); |
| 57 | 57 | ||
| 58 | using BufferId = SlotId; | 58 | using BufferId = Common::SlotId; |
| 59 | 59 | ||
| 60 | using VideoCore::Surface::PixelFormat; | 60 | using VideoCore::Surface::PixelFormat; |
| 61 | using namespace Common::Literals; | 61 | using namespace Common::Literals; |
| @@ -559,7 +559,7 @@ private: | |||
| 559 | 559 | ||
| 560 | Tegra::MaxwellDeviceMemoryManager& device_memory; | 560 | Tegra::MaxwellDeviceMemoryManager& device_memory; |
| 561 | 561 | ||
| 562 | SlotVector<Buffer> slot_buffers; | 562 | Common::SlotVector<Buffer> slot_buffers; |
| 563 | DelayedDestructionRing<Buffer, 8> delayed_destruction_ring; | 563 | DelayedDestructionRing<Buffer, 8> delayed_destruction_ring; |
| 564 | 564 | ||
| 565 | const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect{}; | 565 | const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect{}; |
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 4861b123a..e1019f228 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h | |||
| @@ -18,12 +18,12 @@ | |||
| 18 | 18 | ||
| 19 | #include "common/assert.h" | 19 | #include "common/assert.h" |
| 20 | #include "common/settings.h" | 20 | #include "common/settings.h" |
| 21 | #include "common/slot_vector.h" | ||
| 21 | #include "video_core/control/channel_state_cache.h" | 22 | #include "video_core/control/channel_state_cache.h" |
| 22 | #include "video_core/engines/maxwell_3d.h" | 23 | #include "video_core/engines/maxwell_3d.h" |
| 23 | #include "video_core/host1x/gpu_device_memory_manager.h" | 24 | #include "video_core/host1x/gpu_device_memory_manager.h" |
| 24 | #include "video_core/memory_manager.h" | 25 | #include "video_core/memory_manager.h" |
| 25 | #include "video_core/rasterizer_interface.h" | 26 | #include "video_core/rasterizer_interface.h" |
| 26 | #include "video_core/texture_cache/slot_vector.h" | ||
| 27 | 27 | ||
| 28 | namespace VideoCore { | 28 | namespace VideoCore { |
| 29 | enum class QueryType { | 29 | enum class QueryType { |
| @@ -37,7 +37,7 @@ constexpr std::size_t NumQueryTypes = static_cast<size_t>(QueryType::Count); | |||
| 37 | 37 | ||
| 38 | namespace VideoCommon { | 38 | namespace VideoCommon { |
| 39 | 39 | ||
| 40 | using AsyncJobId = SlotId; | 40 | using AsyncJobId = Common::SlotId; |
| 41 | 41 | ||
| 42 | static constexpr AsyncJobId NULL_ASYNC_JOB_ID{0}; | 42 | static constexpr AsyncJobId NULL_ASYNC_JOB_ID{0}; |
| 43 | 43 | ||
| @@ -341,7 +341,7 @@ private: | |||
| 341 | static constexpr std::uintptr_t YUZU_PAGESIZE = 4096; | 341 | static constexpr std::uintptr_t YUZU_PAGESIZE = 4096; |
| 342 | static constexpr unsigned YUZU_PAGEBITS = 12; | 342 | static constexpr unsigned YUZU_PAGEBITS = 12; |
| 343 | 343 | ||
| 344 | SlotVector<AsyncJob> slot_async_jobs; | 344 | Common::SlotVector<AsyncJob> slot_async_jobs; |
| 345 | 345 | ||
| 346 | VideoCore::RasterizerInterface& rasterizer; | 346 | VideoCore::RasterizerInterface& rasterizer; |
| 347 | Tegra::MaxwellDeviceMemoryManager& device_memory; | 347 | Tegra::MaxwellDeviceMemoryManager& device_memory; |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index af34c272b..022275fd6 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -90,7 +90,7 @@ public: | |||
| 90 | void PostCopyBarrier(); | 90 | void PostCopyBarrier(); |
| 91 | void Finish(); | 91 | void Finish(); |
| 92 | 92 | ||
| 93 | void TickFrame(VideoCommon::SlotVector<Buffer>&) noexcept {} | 93 | void TickFrame(Common::SlotVector<Buffer>&) noexcept {} |
| 94 | 94 | ||
| 95 | void ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value); | 95 | void ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value); |
| 96 | 96 | ||
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 3e54edcc2..d4165d8e4 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -30,13 +30,13 @@ class Image; | |||
| 30 | class ImageView; | 30 | class ImageView; |
| 31 | class Sampler; | 31 | class Sampler; |
| 32 | 32 | ||
| 33 | using Common::SlotVector; | ||
| 33 | using VideoCommon::ImageId; | 34 | using VideoCommon::ImageId; |
| 34 | using VideoCommon::ImageViewId; | 35 | using VideoCommon::ImageViewId; |
| 35 | using VideoCommon::ImageViewType; | 36 | using VideoCommon::ImageViewType; |
| 36 | using VideoCommon::NUM_RT; | 37 | using VideoCommon::NUM_RT; |
| 37 | using VideoCommon::Region2D; | 38 | using VideoCommon::Region2D; |
| 38 | using VideoCommon::RenderTargets; | 39 | using VideoCommon::RenderTargets; |
| 39 | using VideoCommon::SlotVector; | ||
| 40 | 40 | ||
| 41 | struct FormatProperties { | 41 | struct FormatProperties { |
| 42 | GLenum compatibility_class; | 42 | GLenum compatibility_class; |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 31001d142..e5e1e3ab6 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -368,7 +368,7 @@ u32 BufferCacheRuntime::GetStorageBufferAlignment() const { | |||
| 368 | return static_cast<u32>(device.GetStorageBufferAlignment()); | 368 | return static_cast<u32>(device.GetStorageBufferAlignment()); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | void BufferCacheRuntime::TickFrame(VideoCommon::SlotVector<Buffer>& slot_buffers) noexcept { | 371 | void BufferCacheRuntime::TickFrame(Common::SlotVector<Buffer>& slot_buffers) noexcept { |
| 372 | for (auto it = slot_buffers.begin(); it != slot_buffers.end(); it++) { | 372 | for (auto it = slot_buffers.begin(); it != slot_buffers.end(); it++) { |
| 373 | it->ResetUsageTracking(); | 373 | it->ResetUsageTracking(); |
| 374 | } | 374 | } |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index e273f4988..ac14c9f86 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -81,7 +81,7 @@ public: | |||
| 81 | ComputePassDescriptorQueue& compute_pass_descriptor_queue, | 81 | ComputePassDescriptorQueue& compute_pass_descriptor_queue, |
| 82 | DescriptorPool& descriptor_pool); | 82 | DescriptorPool& descriptor_pool); |
| 83 | 83 | ||
| 84 | void TickFrame(VideoCommon::SlotVector<Buffer>& slot_buffers) noexcept; | 84 | void TickFrame(Common::SlotVector<Buffer>& slot_buffers) noexcept; |
| 85 | 85 | ||
| 86 | void Finish(); | 86 | void Finish(); |
| 87 | 87 | ||
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 0dbde65d6..aaeb5ef93 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -20,11 +20,11 @@ struct ResolutionScalingInfo; | |||
| 20 | 20 | ||
| 21 | namespace Vulkan { | 21 | namespace Vulkan { |
| 22 | 22 | ||
| 23 | using Common::SlotVector; | ||
| 23 | using VideoCommon::ImageId; | 24 | using VideoCommon::ImageId; |
| 24 | using VideoCommon::NUM_RT; | 25 | using VideoCommon::NUM_RT; |
| 25 | using VideoCommon::Region2D; | 26 | using VideoCommon::Region2D; |
| 26 | using VideoCommon::RenderTargets; | 27 | using VideoCommon::RenderTargets; |
| 27 | using VideoCommon::SlotVector; | ||
| 28 | using VideoCore::Surface::PixelFormat; | 28 | using VideoCore::Surface::PixelFormat; |
| 29 | 29 | ||
| 30 | class BlitImageHelper; | 30 | class BlitImageHelper; |
diff --git a/src/video_core/texture_cache/slot_vector.h b/src/video_core/texture_cache/slot_vector.h deleted file mode 100644 index 3ffa2a661..000000000 --- a/src/video_core/texture_cache/slot_vector.h +++ /dev/null | |||
| @@ -1,227 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <algorithm> | ||
| 7 | #include <bit> | ||
| 8 | #include <numeric> | ||
| 9 | #include <type_traits> | ||
| 10 | #include <utility> | ||
| 11 | #include <vector> | ||
| 12 | |||
| 13 | #include "common/assert.h" | ||
| 14 | #include "common/common_types.h" | ||
| 15 | #include "common/polyfill_ranges.h" | ||
| 16 | |||
| 17 | namespace VideoCommon { | ||
| 18 | |||
| 19 | struct SlotId { | ||
| 20 | static constexpr u32 INVALID_INDEX = std::numeric_limits<u32>::max(); | ||
| 21 | |||
| 22 | constexpr auto operator<=>(const SlotId&) const noexcept = default; | ||
| 23 | |||
| 24 | constexpr explicit operator bool() const noexcept { | ||
| 25 | return index != INVALID_INDEX; | ||
| 26 | } | ||
| 27 | |||
| 28 | u32 index = INVALID_INDEX; | ||
| 29 | }; | ||
| 30 | |||
| 31 | template <class T> | ||
| 32 | requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T> | ||
| 33 | class SlotVector { | ||
| 34 | public: | ||
| 35 | class Iterator { | ||
| 36 | friend SlotVector<T>; | ||
| 37 | |||
| 38 | public: | ||
| 39 | constexpr Iterator() = default; | ||
| 40 | |||
| 41 | Iterator& operator++() noexcept { | ||
| 42 | const u64* const bitset = slot_vector->stored_bitset.data(); | ||
| 43 | const u32 size = static_cast<u32>(slot_vector->stored_bitset.size()) * 64; | ||
| 44 | if (id.index < size) { | ||
| 45 | do { | ||
| 46 | ++id.index; | ||
| 47 | } while (id.index < size && !IsValid(bitset)); | ||
| 48 | if (id.index == size) { | ||
| 49 | id.index = SlotId::INVALID_INDEX; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | return *this; | ||
| 53 | } | ||
| 54 | |||
| 55 | Iterator operator++(int) noexcept { | ||
| 56 | const Iterator copy{*this}; | ||
| 57 | ++*this; | ||
| 58 | return copy; | ||
| 59 | } | ||
| 60 | |||
| 61 | bool operator==(const Iterator& other) const noexcept { | ||
| 62 | return id.index == other.id.index; | ||
| 63 | } | ||
| 64 | |||
| 65 | bool operator!=(const Iterator& other) const noexcept { | ||
| 66 | return id.index != other.id.index; | ||
| 67 | } | ||
| 68 | |||
| 69 | std::pair<SlotId, T*> operator*() const noexcept { | ||
| 70 | return {id, std::addressof((*slot_vector)[id])}; | ||
| 71 | } | ||
| 72 | |||
| 73 | T* operator->() const noexcept { | ||
| 74 | return std::addressof((*slot_vector)[id]); | ||
| 75 | } | ||
| 76 | |||
| 77 | private: | ||
| 78 | Iterator(SlotVector<T>* slot_vector_, SlotId id_) noexcept | ||
| 79 | : slot_vector{slot_vector_}, id{id_} {} | ||
| 80 | |||
| 81 | bool IsValid(const u64* bitset) const noexcept { | ||
| 82 | return ((bitset[id.index / 64] >> (id.index % 64)) & 1) != 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | SlotVector<T>* slot_vector; | ||
| 86 | SlotId id; | ||
| 87 | }; | ||
| 88 | |||
| 89 | ~SlotVector() noexcept { | ||
| 90 | size_t index = 0; | ||
| 91 | for (u64 bits : stored_bitset) { | ||
| 92 | for (size_t bit = 0; bits; ++bit, bits >>= 1) { | ||
| 93 | if ((bits & 1) != 0) { | ||
| 94 | values[index + bit].object.~T(); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | index += 64; | ||
| 98 | } | ||
| 99 | delete[] values; | ||
| 100 | } | ||
| 101 | |||
| 102 | [[nodiscard]] T& operator[](SlotId id) noexcept { | ||
| 103 | ValidateIndex(id); | ||
| 104 | return values[id.index].object; | ||
| 105 | } | ||
| 106 | |||
| 107 | [[nodiscard]] const T& operator[](SlotId id) const noexcept { | ||
| 108 | ValidateIndex(id); | ||
| 109 | return values[id.index].object; | ||
| 110 | } | ||
| 111 | |||
| 112 | template <typename... Args> | ||
| 113 | [[nodiscard]] SlotId insert(Args&&... args) noexcept { | ||
| 114 | const u32 index = FreeValueIndex(); | ||
| 115 | new (&values[index].object) T(std::forward<Args>(args)...); | ||
| 116 | SetStorageBit(index); | ||
| 117 | |||
| 118 | return SlotId{index}; | ||
| 119 | } | ||
| 120 | |||
| 121 | void erase(SlotId id) noexcept { | ||
| 122 | values[id.index].object.~T(); | ||
| 123 | free_list.push_back(id.index); | ||
| 124 | ResetStorageBit(id.index); | ||
| 125 | } | ||
| 126 | |||
| 127 | [[nodiscard]] Iterator begin() noexcept { | ||
| 128 | const auto it = std::ranges::find_if(stored_bitset, [](u64 value) { return value != 0; }); | ||
| 129 | if (it == stored_bitset.end()) { | ||
| 130 | return end(); | ||
| 131 | } | ||
| 132 | const u32 word_index = static_cast<u32>(std::distance(it, stored_bitset.begin())); | ||
| 133 | const SlotId first_id{word_index * 64 + static_cast<u32>(std::countr_zero(*it))}; | ||
| 134 | return Iterator(this, first_id); | ||
| 135 | } | ||
| 136 | |||
| 137 | [[nodiscard]] Iterator end() noexcept { | ||
| 138 | return Iterator(this, SlotId{SlotId::INVALID_INDEX}); | ||
| 139 | } | ||
| 140 | |||
| 141 | [[nodiscard]] size_t size() const noexcept { | ||
| 142 | return values_capacity - free_list.size(); | ||
| 143 | } | ||
| 144 | |||
| 145 | private: | ||
| 146 | struct NonTrivialDummy { | ||
| 147 | NonTrivialDummy() noexcept {} | ||
| 148 | }; | ||
| 149 | |||
| 150 | union Entry { | ||
| 151 | Entry() noexcept : dummy{} {} | ||
| 152 | ~Entry() noexcept {} | ||
| 153 | |||
| 154 | NonTrivialDummy dummy; | ||
| 155 | T object; | ||
| 156 | }; | ||
| 157 | |||
| 158 | void SetStorageBit(u32 index) noexcept { | ||
| 159 | stored_bitset[index / 64] |= u64(1) << (index % 64); | ||
| 160 | } | ||
| 161 | |||
| 162 | void ResetStorageBit(u32 index) noexcept { | ||
| 163 | stored_bitset[index / 64] &= ~(u64(1) << (index % 64)); | ||
| 164 | } | ||
| 165 | |||
| 166 | bool ReadStorageBit(u32 index) noexcept { | ||
| 167 | return ((stored_bitset[index / 64] >> (index % 64)) & 1) != 0; | ||
| 168 | } | ||
| 169 | |||
| 170 | void ValidateIndex(SlotId id) const noexcept { | ||
| 171 | DEBUG_ASSERT(id); | ||
| 172 | DEBUG_ASSERT(id.index / 64 < stored_bitset.size()); | ||
| 173 | DEBUG_ASSERT(((stored_bitset[id.index / 64] >> (id.index % 64)) & 1) != 0); | ||
| 174 | } | ||
| 175 | |||
| 176 | [[nodiscard]] u32 FreeValueIndex() noexcept { | ||
| 177 | if (free_list.empty()) { | ||
| 178 | Reserve(values_capacity ? (values_capacity << 1) : 1); | ||
| 179 | } | ||
| 180 | const u32 free_index = free_list.back(); | ||
| 181 | free_list.pop_back(); | ||
| 182 | return free_index; | ||
| 183 | } | ||
| 184 | |||
| 185 | void Reserve(size_t new_capacity) noexcept { | ||
| 186 | Entry* const new_values = new Entry[new_capacity]; | ||
| 187 | size_t index = 0; | ||
| 188 | for (u64 bits : stored_bitset) { | ||
| 189 | for (size_t bit = 0; bits; ++bit, bits >>= 1) { | ||
| 190 | const size_t i = index + bit; | ||
| 191 | if ((bits & 1) == 0) { | ||
| 192 | continue; | ||
| 193 | } | ||
| 194 | T& old_value = values[i].object; | ||
| 195 | new (&new_values[i].object) T(std::move(old_value)); | ||
| 196 | old_value.~T(); | ||
| 197 | } | ||
| 198 | index += 64; | ||
| 199 | } | ||
| 200 | |||
| 201 | stored_bitset.resize((new_capacity + 63) / 64); | ||
| 202 | |||
| 203 | const size_t old_free_size = free_list.size(); | ||
| 204 | free_list.resize(old_free_size + (new_capacity - values_capacity)); | ||
| 205 | std::iota(free_list.begin() + old_free_size, free_list.end(), | ||
| 206 | static_cast<u32>(values_capacity)); | ||
| 207 | |||
| 208 | delete[] values; | ||
| 209 | values = new_values; | ||
| 210 | values_capacity = new_capacity; | ||
| 211 | } | ||
| 212 | |||
| 213 | Entry* values = nullptr; | ||
| 214 | size_t values_capacity = 0; | ||
| 215 | |||
| 216 | std::vector<u64> stored_bitset; | ||
| 217 | std::vector<u32> free_list; | ||
| 218 | }; | ||
| 219 | |||
| 220 | } // namespace VideoCommon | ||
| 221 | |||
| 222 | template <> | ||
| 223 | struct std::hash<VideoCommon::SlotId> { | ||
| 224 | size_t operator()(const VideoCommon::SlotId& id) const noexcept { | ||
| 225 | return std::hash<u32>{}(id.index); | ||
| 226 | } | ||
| 227 | }; | ||
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index e7b910121..da98a634b 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "common/lru_cache.h" | 21 | #include "common/lru_cache.h" |
| 22 | #include "common/polyfill_ranges.h" | 22 | #include "common/polyfill_ranges.h" |
| 23 | #include "common/scratch_buffer.h" | 23 | #include "common/scratch_buffer.h" |
| 24 | #include "common/slot_vector.h" | ||
| 24 | #include "common/thread_worker.h" | 25 | #include "common/thread_worker.h" |
| 25 | #include "video_core/compatible_formats.h" | 26 | #include "video_core/compatible_formats.h" |
| 26 | #include "video_core/control/channel_state_cache.h" | 27 | #include "video_core/control/channel_state_cache.h" |
| @@ -32,7 +33,6 @@ | |||
| 32 | #include "video_core/texture_cache/image_info.h" | 33 | #include "video_core/texture_cache/image_info.h" |
| 33 | #include "video_core/texture_cache/image_view_base.h" | 34 | #include "video_core/texture_cache/image_view_base.h" |
| 34 | #include "video_core/texture_cache/render_targets.h" | 35 | #include "video_core/texture_cache/render_targets.h" |
| 35 | #include "video_core/texture_cache/slot_vector.h" | ||
| 36 | #include "video_core/texture_cache/types.h" | 36 | #include "video_core/texture_cache/types.h" |
| 37 | #include "video_core/textures/texture.h" | 37 | #include "video_core/textures/texture.h" |
| 38 | 38 | ||
| @@ -451,16 +451,16 @@ private: | |||
| 451 | struct PendingDownload { | 451 | struct PendingDownload { |
| 452 | bool is_swizzle; | 452 | bool is_swizzle; |
| 453 | size_t async_buffer_id; | 453 | size_t async_buffer_id; |
| 454 | SlotId object_id; | 454 | Common::SlotId object_id; |
| 455 | }; | 455 | }; |
| 456 | 456 | ||
| 457 | SlotVector<Image> slot_images; | 457 | Common::SlotVector<Image> slot_images; |
| 458 | SlotVector<ImageMapView> slot_map_views; | 458 | Common::SlotVector<ImageMapView> slot_map_views; |
| 459 | SlotVector<ImageView> slot_image_views; | 459 | Common::SlotVector<ImageView> slot_image_views; |
| 460 | SlotVector<ImageAlloc> slot_image_allocs; | 460 | Common::SlotVector<ImageAlloc> slot_image_allocs; |
| 461 | SlotVector<Sampler> slot_samplers; | 461 | Common::SlotVector<Sampler> slot_samplers; |
| 462 | SlotVector<Framebuffer> slot_framebuffers; | 462 | Common::SlotVector<Framebuffer> slot_framebuffers; |
| 463 | SlotVector<BufferDownload> slot_buffer_downloads; | 463 | Common::SlotVector<BufferDownload> slot_buffer_downloads; |
| 464 | 464 | ||
| 465 | // TODO: This data structure is not optimal and it should be reworked | 465 | // TODO: This data structure is not optimal and it should be reworked |
| 466 | 466 | ||
diff --git a/src/video_core/texture_cache/types.h b/src/video_core/texture_cache/types.h index 0453456b4..07c304386 100644 --- a/src/video_core/texture_cache/types.h +++ b/src/video_core/texture_cache/types.h | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_funcs.h" | 6 | #include "common/common_funcs.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "video_core/texture_cache/slot_vector.h" | 8 | #include "common/slot_vector.h" |
| 9 | 9 | ||
| 10 | namespace VideoCommon { | 10 | namespace VideoCommon { |
| 11 | 11 | ||
| 12 | constexpr size_t NUM_RT = 8; | 12 | constexpr size_t NUM_RT = 8; |
| 13 | constexpr size_t MAX_MIP_LEVELS = 14; | 13 | constexpr size_t MAX_MIP_LEVELS = 14; |
| 14 | 14 | ||
| 15 | constexpr SlotId CORRUPT_ID{0xfffffffe}; | 15 | constexpr Common::SlotId CORRUPT_ID{0xfffffffe}; |
| 16 | 16 | ||
| 17 | using ImageId = SlotId; | 17 | using ImageId = Common::SlotId; |
| 18 | using ImageMapId = SlotId; | 18 | using ImageMapId = Common::SlotId; |
| 19 | using ImageViewId = SlotId; | 19 | using ImageViewId = Common::SlotId; |
| 20 | using ImageAllocId = SlotId; | 20 | using ImageAllocId = Common::SlotId; |
| 21 | using SamplerId = SlotId; | 21 | using SamplerId = Common::SlotId; |
| 22 | using FramebufferId = SlotId; | 22 | using FramebufferId = Common::SlotId; |
| 23 | 23 | ||
| 24 | /// Fake image ID for null image views | 24 | /// Fake image ID for null image views |
| 25 | constexpr ImageId NULL_IMAGE_ID{0}; | 25 | constexpr ImageId NULL_IMAGE_ID{0}; |