rasterizer_cache: Explicit type in traits

This commit is contained in:
GPUCode
2023-02-15 21:24:34 +02:00
parent e67a4a739a
commit 234cfd25ed
4 changed files with 15 additions and 15 deletions

View File

@ -25,7 +25,7 @@ inline auto RangeFromInterval(auto& map, const auto& interval) {
} }
template <class T> template <class T>
RasterizerCache<T>::RasterizerCache(Memory::MemorySystem& memory_, TextureRuntime& runtime_) RasterizerCache<T>::RasterizerCache(Memory::MemorySystem& memory_, Runtime& runtime_)
: memory{memory_}, runtime{runtime_}, resolution_scale_factor{ : memory{memory_}, runtime{runtime_}, resolution_scale_factor{
VideoCore::GetResolutionScaleFactor()} { VideoCore::GetResolutionScaleFactor()} {
using TextureConfig = Pica::TexturingRegs::TextureConfig; using TextureConfig = Pica::TexturingRegs::TextureConfig;
@ -198,7 +198,7 @@ bool RasterizerCache<T>::AccelerateFill(const GPU::Regs::MemoryFillConfig& confi
params.type = SurfaceType::Fill; params.type = SurfaceType::Fill;
params.res_scale = std::numeric_limits<u16>::max(); params.res_scale = std::numeric_limits<u16>::max();
Surface fill_surface = std::make_shared<typename T::SurfaceType>(params, runtime); Surface fill_surface = std::make_shared<typename T::Surface>(params, runtime);
std::memcpy(&fill_surface->fill_data[0], &config.value_32bit, 4); std::memcpy(&fill_surface->fill_data[0], &config.value_32bit, 4);
if (config.fill_32bit) { if (config.fill_32bit) {
@ -1146,7 +1146,7 @@ void RasterizerCache<T>::InvalidateRegion(PAddr addr, u32 size, const Surface& r
template <class T> template <class T>
auto RasterizerCache<T>::CreateSurface(SurfaceParams& params) -> Surface { auto RasterizerCache<T>::CreateSurface(SurfaceParams& params) -> Surface {
Surface surface = std::make_shared<typename T::SurfaceType>(params, runtime); Surface surface = std::make_shared<typename T::Surface>(params, runtime);
surface->invalid_regions.insert(surface->GetInterval()); surface->invalid_regions.insert(surface->GetInterval());
return surface; return surface;
} }

View File

@ -44,8 +44,8 @@ class RasterizerCache : NonCopyable {
/// Address shift for caching surfaces into a hash table /// Address shift for caching surfaces into a hash table
static constexpr u64 CITRA_PAGEBITS = 18; static constexpr u64 CITRA_PAGEBITS = 18;
using TextureRuntime = typename T::RuntimeType; using Runtime = typename T::Runtime;
using Surface = std::shared_ptr<typename T::SurfaceType>; using Surface = std::shared_ptr<typename T::Surface>;
using Sampler = typename T::Sampler; using Sampler = typename T::Sampler;
using Framebuffer = typename T::Framebuffer; using Framebuffer = typename T::Framebuffer;
@ -58,7 +58,7 @@ class RasterizerCache : NonCopyable {
using PageMap = boost::icl::interval_map<u32, int>; using PageMap = boost::icl::interval_map<u32, int>;
public: public:
RasterizerCache(Memory::MemorySystem& memory, TextureRuntime& runtime); RasterizerCache(Memory::MemorySystem& memory, Runtime& runtime);
~RasterizerCache(); ~RasterizerCache();
/// Perform hardware accelerated texture copy according to the provided configuration /// Perform hardware accelerated texture copy according to the provided configuration
@ -184,7 +184,7 @@ private:
private: private:
Memory::MemorySystem& memory; Memory::MemorySystem& memory;
TextureRuntime& runtime; Runtime& runtime;
PageMap cached_pages; PageMap cached_pages;
SurfaceMap dirty_regions; SurfaceMap dirty_regions;
std::vector<Surface> remove_surfaces; std::vector<Surface> remove_surfaces;

View File

@ -179,10 +179,10 @@ private:
}; };
struct Traits { struct Traits {
using RuntimeType = TextureRuntime; using Runtime = OpenGL::TextureRuntime;
using SurfaceType = Surface; using Surface = OpenGL::Surface;
using Sampler = Sampler; using Sampler = OpenGL::Sampler;
using Framebuffer = Framebuffer; using Framebuffer = OpenGL::Framebuffer;
}; };
using RasterizerCache = VideoCore::RasterizerCache<Traits>; using RasterizerCache = VideoCore::RasterizerCache<Traits>;

View File

@ -299,10 +299,10 @@ private:
}; };
struct Traits { struct Traits {
using RuntimeType = TextureRuntime; using Runtime = Vulkan::TextureRuntime;
using SurfaceType = Surface; using Surface = Vulkan::Surface;
using Sampler = Sampler; using Sampler = Vulkan::Sampler;
using Framebuffer = Framebuffer; using Framebuffer = Vulkan::Framebuffer;
}; };
using RasterizerCache = VideoCore::RasterizerCache<Traits>; using RasterizerCache = VideoCore::RasterizerCache<Traits>;