summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2024-02-03 22:51:04 +0100
committerGravatar Fernando Sahmkow2024-02-04 20:01:47 +0100
commit4841dc0b745389fb03edbf900f25511bee4b3d88 (patch)
tree40149c44691369597dec8f126bab6bc1b808e93f /src
parentMerge pull request #12901 from Kelebek1/timezone_firmware_fix (diff)
downloadyuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.tar.gz
yuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.tar.xz
yuzu-4841dc0b745389fb03edbf900f25511bee4b3d88.zip
VideoCore: Move Slot Vector to Common
Diffstat (limited to 'src')
-rw-r--r--src/common/CMakeLists.txt1
-rw-r--r--src/common/slot_vector.h (renamed from src/video_core/texture_cache/slot_vector.h)8
-rw-r--r--src/video_core/CMakeLists.txt1
-rw-r--r--src/video_core/buffer_cache/buffer_cache_base.h6
-rw-r--r--src/video_core/query_cache.h6
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.h2
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.h2
-rw-r--r--src/video_core/texture_cache/texture_cache_base.h18
-rw-r--r--src/video_core/texture_cache/types.h16
12 files changed, 33 insertions, 33 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 85926fc8f..bf3f3b781 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -121,6 +121,7 @@ add_library(common STATIC
121 settings_input.cpp 121 settings_input.cpp
122 settings_input.h 122 settings_input.h
123 settings_setting.h 123 settings_setting.h
124 slot_vector.h
124 socket_types.h 125 socket_types.h
125 spin_lock.cpp 126 spin_lock.cpp
126 spin_lock.h 127 spin_lock.h
diff --git a/src/video_core/texture_cache/slot_vector.h b/src/common/slot_vector.h
index 3ffa2a661..34ff7de94 100644
--- a/src/video_core/texture_cache/slot_vector.h
+++ b/src/common/slot_vector.h
@@ -14,7 +14,7 @@
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/polyfill_ranges.h" 15#include "common/polyfill_ranges.h"
16 16
17namespace VideoCommon { 17namespace Common {
18 18
19struct SlotId { 19struct SlotId {
20 static constexpr u32 INVALID_INDEX = std::numeric_limits<u32>::max(); 20 static constexpr u32 INVALID_INDEX = std::numeric_limits<u32>::max();
@@ -217,11 +217,11 @@ private:
217 std::vector<u32> free_list; 217 std::vector<u32> free_list;
218}; 218};
219 219
220} // namespace VideoCommon 220} // namespace Common
221 221
222template <> 222template <>
223struct std::hash<VideoCommon::SlotId> { 223struct std::hash<Common::SlotId> {
224 size_t operator()(const VideoCommon::SlotId& id) const noexcept { 224 size_t operator()(const Common::SlotId& id) const noexcept {
225 return std::hash<u32>{}(id.index); 225 return std::hash<u32>{}(id.index);
226 } 226 }
227}; 227};
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
47namespace boost { 47namespace boost {
@@ -55,7 +55,7 @@ MICROPROFILE_DECLARE(GPU_PrepareBuffers);
55MICROPROFILE_DECLARE(GPU_BindUploadBuffers); 55MICROPROFILE_DECLARE(GPU_BindUploadBuffers);
56MICROPROFILE_DECLARE(GPU_DownloadMemory); 56MICROPROFILE_DECLARE(GPU_DownloadMemory);
57 57
58using BufferId = SlotId; 58using BufferId = Common::SlotId;
59 59
60using VideoCore::Surface::PixelFormat; 60using VideoCore::Surface::PixelFormat;
61using namespace Common::Literals; 61using 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
28namespace VideoCore { 28namespace VideoCore {
29enum class QueryType { 29enum class QueryType {
@@ -37,7 +37,7 @@ constexpr std::size_t NumQueryTypes = static_cast<size_t>(QueryType::Count);
37 37
38namespace VideoCommon { 38namespace VideoCommon {
39 39
40using AsyncJobId = SlotId; 40using AsyncJobId = Common::SlotId;
41 41
42static constexpr AsyncJobId NULL_ASYNC_JOB_ID{0}; 42static 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;
30class ImageView; 30class ImageView;
31class Sampler; 31class Sampler;
32 32
33using Common::SlotVector;
33using VideoCommon::ImageId; 34using VideoCommon::ImageId;
34using VideoCommon::ImageViewId; 35using VideoCommon::ImageViewId;
35using VideoCommon::ImageViewType; 36using VideoCommon::ImageViewType;
36using VideoCommon::NUM_RT; 37using VideoCommon::NUM_RT;
37using VideoCommon::Region2D; 38using VideoCommon::Region2D;
38using VideoCommon::RenderTargets; 39using VideoCommon::RenderTargets;
39using VideoCommon::SlotVector;
40 40
41struct FormatProperties { 41struct 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
371void BufferCacheRuntime::TickFrame(VideoCommon::SlotVector<Buffer>& slot_buffers) noexcept { 371void 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
21namespace Vulkan { 21namespace Vulkan {
22 22
23using Common::SlotVector;
23using VideoCommon::ImageId; 24using VideoCommon::ImageId;
24using VideoCommon::NUM_RT; 25using VideoCommon::NUM_RT;
25using VideoCommon::Region2D; 26using VideoCommon::Region2D;
26using VideoCommon::RenderTargets; 27using VideoCommon::RenderTargets;
27using VideoCommon::SlotVector;
28using VideoCore::Surface::PixelFormat; 28using VideoCore::Surface::PixelFormat;
29 29
30class BlitImageHelper; 30class BlitImageHelper;
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
10namespace VideoCommon { 10namespace VideoCommon {
11 11
12constexpr size_t NUM_RT = 8; 12constexpr size_t NUM_RT = 8;
13constexpr size_t MAX_MIP_LEVELS = 14; 13constexpr size_t MAX_MIP_LEVELS = 14;
14 14
15constexpr SlotId CORRUPT_ID{0xfffffffe}; 15constexpr Common::SlotId CORRUPT_ID{0xfffffffe};
16 16
17using ImageId = SlotId; 17using ImageId = Common::SlotId;
18using ImageMapId = SlotId; 18using ImageMapId = Common::SlotId;
19using ImageViewId = SlotId; 19using ImageViewId = Common::SlotId;
20using ImageAllocId = SlotId; 20using ImageAllocId = Common::SlotId;
21using SamplerId = SlotId; 21using SamplerId = Common::SlotId;
22using FramebufferId = SlotId; 22using FramebufferId = Common::SlotId;
23 23
24/// Fake image ID for null image views 24/// Fake image ID for null image views
25constexpr ImageId NULL_IMAGE_ID{0}; 25constexpr ImageId NULL_IMAGE_ID{0};