yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

texture_cache: Query MemoryManager from the system

This commit is contained in:
Fernando Sahmkow 2019-06-25 17:26:00 -04:00
parent 7565389700
commit 58c8a44e7a
5 changed files with 7 additions and 20 deletions

View File

@ -32,7 +32,6 @@ u32 FramebufferConfig::BytesPerPixel(PixelFormat format) {
GPU::GPU(Core::System& system, VideoCore::RendererBase& renderer) : renderer{renderer} {
auto& rasterizer{renderer.Rasterizer()};
memory_manager = std::make_unique<Tegra::MemoryManager>(rasterizer);
rasterizer.InitMemoryMananger(*memory_manager);
dma_pusher = std::make_unique<Tegra::DmaPusher>(*this);
maxwell_3d = std::make_unique<Engines::Maxwell3D>(system, rasterizer, *memory_manager);
fermi_2d = std::make_unique<Engines::Fermi2D>(rasterizer, *memory_manager);

View File

@ -28,8 +28,6 @@ class RasterizerInterface {
public:
virtual ~RasterizerInterface() {}
virtual void InitMemoryMananger(Tegra::MemoryManager& memory_manager) = 0;
/// Draw the current batch of vertex arrays
virtual void DrawArrays() = 0;

View File

@ -97,10 +97,6 @@ RasterizerOpenGL::RasterizerOpenGL(Core::System& system, Core::Frontend::EmuWind
RasterizerOpenGL::~RasterizerOpenGL() {}
void RasterizerOpenGL::InitMemoryMananger(Tegra::MemoryManager& memory_manager) {
texture_cache.InitMemoryMananger(memory_manager);
}
void RasterizerOpenGL::CheckExtensions() {
if (!GLAD_GL_ARB_texture_filter_anisotropic && !GLAD_GL_EXT_texture_filter_anisotropic) {
LOG_WARNING(

View File

@ -57,8 +57,6 @@ public:
ScreenInfo& info);
~RasterizerOpenGL() override;
void InitMemoryMananger(Tegra::MemoryManager& memory_manager) override;
void DrawArrays() override;
void Clear() override;
void FlushAll() override;

View File

@ -52,10 +52,6 @@ class TextureCache {
using IntervalType = typename IntervalMap::interval_type;
public:
void InitMemoryMananger(Tegra::MemoryManager& memory_manager) {
this->memory_manager = &memory_manager;
}
void InvalidateRegion(CacheAddr addr, std::size_t size) {
std::lock_guard lock{mutex};
@ -278,15 +274,16 @@ protected:
void Register(TSurface surface) {
const GPUVAddr gpu_addr = surface->GetGpuAddr();
const CacheAddr cache_ptr = ToCacheAddr(memory_manager->GetPointer(gpu_addr));
const CacheAddr cache_ptr = ToCacheAddr(system.GPU().MemoryManager().GetPointer(gpu_addr));
const std::size_t size = surface->GetSizeInBytes();
const std::optional<VAddr> cpu_addr = memory_manager->GpuToCpuAddress(gpu_addr);
const std::optional<VAddr> cpu_addr =
system.GPU().MemoryManager().GpuToCpuAddress(gpu_addr);
if (!cache_ptr || !cpu_addr) {
LOG_CRITICAL(HW_GPU, "Failed to register surface with unmapped gpu_address 0x{:016x}",
gpu_addr);
return;
}
bool continuouty = memory_manager->IsBlockContinuous(gpu_addr, size);
bool continuouty = system.GPU().MemoryManager().IsBlockContinuous(gpu_addr, size);
surface->MarkAsContinuous(continuouty);
surface->SetCacheAddr(cache_ptr);
surface->SetCpuAddr(*cpu_addr);
@ -552,7 +549,7 @@ private:
std::pair<TSurface, TView> GetSurface(const GPUVAddr gpu_addr, const SurfaceParams& params,
bool preserve_contents, bool is_render) {
const auto host_ptr{memory_manager->GetPointer(gpu_addr)};
const auto host_ptr{system.GPU().MemoryManager().GetPointer(gpu_addr)};
const auto cache_addr{ToCacheAddr(host_ptr)};
// Step 0: guarantee a valid surface
@ -693,7 +690,7 @@ private:
void LoadSurface(const TSurface& surface) {
staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes());
surface->LoadBuffer(*memory_manager, staging_cache);
surface->LoadBuffer(system.GPU().MemoryManager(), staging_cache);
surface->UploadTexture(staging_cache.GetBuffer(0));
surface->MarkAsModified(false, Tick());
}
@ -704,7 +701,7 @@ private:
}
staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes());
surface->DownloadTexture(staging_cache.GetBuffer(0));
surface->FlushBuffer(*memory_manager, staging_cache);
surface->FlushBuffer(system.GPU().MemoryManager(), staging_cache);
surface->MarkAsModified(false, Tick());
}
@ -778,7 +775,6 @@ private:
};
VideoCore::RasterizerInterface& rasterizer;
Tegra::MemoryManager* memory_manager;
u64 ticks{};