code: Move slot vector to common

This commit is contained in:
GPUCode
2023-05-03 22:27:58 +03:00
parent f5668cdb25
commit 891290abd9
8 changed files with 18 additions and 23 deletions

View File

@@ -100,6 +100,7 @@ add_library(citra_common STATIC
scope_exit.h
settings.cpp
settings.h
slot_vector.h
serialization/atomic.h
serialization/boost_discrete_interval.hpp
serialization/boost_flat_set.h

View File

@@ -5,15 +5,15 @@
#pragma once
#include <bit>
#include <compare>
#include <numeric>
#include <type_traits>
#include <utility>
#include <vector>
#include "common/assert.h"
#include "common/common_types.h"
namespace VideoCore {
namespace Common {
struct SlotId {
static constexpr u32 INVALID_INDEX = std::numeric_limits<u32>::max();
@@ -144,11 +144,11 @@ private:
std::vector<u32> free_list;
};
} // namespace VideoCore
} // namespace Common
template <>
struct std::hash<VideoCore::SlotId> {
size_t operator()(const VideoCore::SlotId& id) const noexcept {
struct std::hash<Common::SlotId> {
size_t operator()(const Common::SlotId& id) const noexcept {
return std::hash<u32>{}(id.index);
}
};

View File

@@ -42,7 +42,6 @@ add_library(video_core STATIC
rasterizer_cache/rasterizer_cache.h
rasterizer_cache/rasterizer_cache_base.h
rasterizer_cache/sampler_params.h
rasterizer_cache/slot_vector.h
rasterizer_cache/surface_base.cpp
rasterizer_cache/surface_base.h
rasterizer_cache/surface_params.cpp

View File

@@ -10,8 +10,6 @@ MICROPROFILE_DEFINE(RasterizerCache_CopySurface, "RasterizerCache", "CopySurface
MP_RGB(128, 192, 64));
MICROPROFILE_DEFINE(RasterizerCache_UploadSurface, "RasterizerCache", "UploadSurface",
MP_RGB(128, 192, 64));
MICROPROFILE_DEFINE(RasterizerCache_ValidateSurface, "RasterizerCache", "ValidateSurface",
MP_RGB(32, 64, 192));
MICROPROFILE_DEFINE(RasterizerCache_DownloadSurface, "RasterizerCache", "DownloadSurface",
MP_RGB(128, 192, 64));
MICROPROFILE_DEFINE(RasterizerCache_Invalidation, "RasterizerCache", "Invalidation",

View File

@@ -211,8 +211,8 @@ private:
std::unordered_map<TextureCubeConfig, TextureCube> texture_cube_cache;
tsl::robin_pg_map<u64, std::vector<SurfaceId>, Common::IdentityHash<u64>> page_table;
std::unordered_map<SamplerParams, SamplerId> samplers;
SlotVector<Surface> slot_surfaces;
SlotVector<Sampler> slot_samplers;
Common::SlotVector<Surface> slot_surfaces;
Common::SlotVector<Sampler> slot_samplers;
SurfaceMap dirty_regions;
PageMap cached_pages;
std::vector<SurfaceId> remove_surfaces;

View File

@@ -6,6 +6,7 @@
#include <boost/icl/interval_set.hpp>
#include "video_core/rasterizer_cache/surface_params.h"
#include "video_core/rasterizer_cache/utils.h"
namespace VideoCore {

View File

@@ -4,11 +4,15 @@
#pragma once
#include <boost/icl/right_open_interval.hpp>
#include "common/math_util.h"
#include "video_core/custom_textures/custom_format.h"
#include "video_core/rasterizer_cache/utils.h"
#include "video_core/rasterizer_cache/pixel_format.h"
namespace VideoCore {
using SurfaceInterval = boost::icl::right_open_interval<PAddr>;
constexpr std::size_t MAX_PICA_LEVELS = 8;
class SurfaceParams {

View File

@@ -4,21 +4,17 @@
#pragma once
#include <compare>
#include <span>
#include <boost/icl/right_open_interval.hpp>
#include "common/hash.h"
#include "common/math_util.h"
#include "common/slot_vector.h"
#include "common/vector_math.h"
#include "video_core/rasterizer_cache/pixel_format.h"
#include "video_core/rasterizer_cache/slot_vector.h"
#include "video_core/regs_texturing.h"
namespace VideoCore {
using SurfaceInterval = boost::icl::right_open_interval<PAddr>;
using SurfaceId = SlotId;
using SamplerId = SlotId;
using SurfaceId = Common::SlotId;
using SamplerId = Common::SlotId;
/// Fake surface ID for null surfaces
constexpr SurfaceId NULL_SURFACE_ID{0};
@@ -28,15 +24,11 @@ constexpr SurfaceId NULL_SURFACE_CUBE_ID{1};
constexpr SamplerId NULL_SAMPLER_ID{0};
struct Offset {
constexpr auto operator<=>(const Offset&) const noexcept = default;
u32 x = 0;
u32 y = 0;
};
struct Extent {
constexpr auto operator<=>(const Extent&) const noexcept = default;
u32 width = 1;
u32 height = 1;
};