diff options
| author | 2019-06-25 17:26:00 -0400 | |
|---|---|---|
| committer | 2019-06-25 17:26:00 -0400 | |
| commit | 58c8a44e7aa18f768db39a36870d8b279257e1d8 (patch) | |
| tree | d303197bae718fa4767d44b7aa22fcd3a633ddc5 /src/video_core/texture_cache | |
| parent | texture_cache: Include "core/core.h" (diff) | |
| download | yuzu-58c8a44e7aa18f768db39a36870d8b279257e1d8.tar.gz yuzu-58c8a44e7aa18f768db39a36870d8b279257e1d8.tar.xz yuzu-58c8a44e7aa18f768db39a36870d8b279257e1d8.zip | |
texture_cache: Query MemoryManager from the system
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index a91b2a220..1516fcea3 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -52,10 +52,6 @@ class TextureCache { | |||
| 52 | using IntervalType = typename IntervalMap::interval_type; | 52 | using IntervalType = typename IntervalMap::interval_type; |
| 53 | 53 | ||
| 54 | public: | 54 | public: |
| 55 | void InitMemoryMananger(Tegra::MemoryManager& memory_manager) { | ||
| 56 | this->memory_manager = &memory_manager; | ||
| 57 | } | ||
| 58 | |||
| 59 | void InvalidateRegion(CacheAddr addr, std::size_t size) { | 55 | void InvalidateRegion(CacheAddr addr, std::size_t size) { |
| 60 | std::lock_guard lock{mutex}; | 56 | std::lock_guard lock{mutex}; |
| 61 | 57 | ||
| @@ -278,15 +274,16 @@ protected: | |||
| 278 | 274 | ||
| 279 | void Register(TSurface surface) { | 275 | void Register(TSurface surface) { |
| 280 | const GPUVAddr gpu_addr = surface->GetGpuAddr(); | 276 | const GPUVAddr gpu_addr = surface->GetGpuAddr(); |
| 281 | const CacheAddr cache_ptr = ToCacheAddr(memory_manager->GetPointer(gpu_addr)); | 277 | const CacheAddr cache_ptr = ToCacheAddr(system.GPU().MemoryManager().GetPointer(gpu_addr)); |
| 282 | const std::size_t size = surface->GetSizeInBytes(); | 278 | const std::size_t size = surface->GetSizeInBytes(); |
| 283 | const std::optional<VAddr> cpu_addr = memory_manager->GpuToCpuAddress(gpu_addr); | 279 | const std::optional<VAddr> cpu_addr = |
| 280 | system.GPU().MemoryManager().GpuToCpuAddress(gpu_addr); | ||
| 284 | if (!cache_ptr || !cpu_addr) { | 281 | if (!cache_ptr || !cpu_addr) { |
| 285 | LOG_CRITICAL(HW_GPU, "Failed to register surface with unmapped gpu_address 0x{:016x}", | 282 | LOG_CRITICAL(HW_GPU, "Failed to register surface with unmapped gpu_address 0x{:016x}", |
| 286 | gpu_addr); | 283 | gpu_addr); |
| 287 | return; | 284 | return; |
| 288 | } | 285 | } |
| 289 | bool continuouty = memory_manager->IsBlockContinuous(gpu_addr, size); | 286 | bool continuouty = system.GPU().MemoryManager().IsBlockContinuous(gpu_addr, size); |
| 290 | surface->MarkAsContinuous(continuouty); | 287 | surface->MarkAsContinuous(continuouty); |
| 291 | surface->SetCacheAddr(cache_ptr); | 288 | surface->SetCacheAddr(cache_ptr); |
| 292 | surface->SetCpuAddr(*cpu_addr); | 289 | surface->SetCpuAddr(*cpu_addr); |
| @@ -552,7 +549,7 @@ private: | |||
| 552 | std::pair<TSurface, TView> GetSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, | 549 | std::pair<TSurface, TView> GetSurface(const GPUVAddr gpu_addr, const SurfaceParams& params, |
| 553 | bool preserve_contents, bool is_render) { | 550 | bool preserve_contents, bool is_render) { |
| 554 | 551 | ||
| 555 | const auto host_ptr{memory_manager->GetPointer(gpu_addr)}; | 552 | const auto host_ptr{system.GPU().MemoryManager().GetPointer(gpu_addr)}; |
| 556 | const auto cache_addr{ToCacheAddr(host_ptr)}; | 553 | const auto cache_addr{ToCacheAddr(host_ptr)}; |
| 557 | 554 | ||
| 558 | // Step 0: guarantee a valid surface | 555 | // Step 0: guarantee a valid surface |
| @@ -693,7 +690,7 @@ private: | |||
| 693 | 690 | ||
| 694 | void LoadSurface(const TSurface& surface) { | 691 | void LoadSurface(const TSurface& surface) { |
| 695 | staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes()); | 692 | staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes()); |
| 696 | surface->LoadBuffer(*memory_manager, staging_cache); | 693 | surface->LoadBuffer(system.GPU().MemoryManager(), staging_cache); |
| 697 | surface->UploadTexture(staging_cache.GetBuffer(0)); | 694 | surface->UploadTexture(staging_cache.GetBuffer(0)); |
| 698 | surface->MarkAsModified(false, Tick()); | 695 | surface->MarkAsModified(false, Tick()); |
| 699 | } | 696 | } |
| @@ -704,7 +701,7 @@ private: | |||
| 704 | } | 701 | } |
| 705 | staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes()); | 702 | staging_cache.GetBuffer(0).resize(surface->GetHostSizeInBytes()); |
| 706 | surface->DownloadTexture(staging_cache.GetBuffer(0)); | 703 | surface->DownloadTexture(staging_cache.GetBuffer(0)); |
| 707 | surface->FlushBuffer(*memory_manager, staging_cache); | 704 | surface->FlushBuffer(system.GPU().MemoryManager(), staging_cache); |
| 708 | surface->MarkAsModified(false, Tick()); | 705 | surface->MarkAsModified(false, Tick()); |
| 709 | } | 706 | } |
| 710 | 707 | ||
| @@ -778,7 +775,6 @@ private: | |||
| 778 | }; | 775 | }; |
| 779 | 776 | ||
| 780 | VideoCore::RasterizerInterface& rasterizer; | 777 | VideoCore::RasterizerInterface& rasterizer; |
| 781 | Tegra::MemoryManager* memory_manager; | ||
| 782 | 778 | ||
| 783 | u64 ticks{}; | 779 | u64 ticks{}; |
| 784 | 780 | ||