diff options
author | bunnei <bunneidev@gmail.com> | 2019-03-17 02:59:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-17 02:59:45 +0100 |
commit | 2392e146b09c2a4b3bb557bb3a20c4afc7f75957 (patch) | |
tree | 1eafa50be7af78d74b4781fbe858277ac8ab1d35 /src/video_core/renderer_opengl/gl_buffer_cache.cpp | |
parent | Merge pull request #2243 from bunnei/mem-simplify-cache (diff) | |
parent | video_core: Refactor to use MemoryManager interface for all memory access. (diff) | |
download | yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.gz yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.bz2 yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.lz yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.xz yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.zst yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index a4eea61a6..5048ed6ce 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp @@ -24,14 +24,12 @@ OGLBufferCache::OGLBufferCache(RasterizerOpenGL& rasterizer, std::size_t size) GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, std::size_t size, std::size_t alignment, bool cache) { auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager(); - const auto cpu_addr{memory_manager.GpuToCpuAddress(gpu_addr)}; - ASSERT_MSG(cpu_addr, "Invalid GPU address"); // Cache management is a big overhead, so only cache entries with a given size. // TODO: Figure out which size is the best for given games. cache &= size >= 2048; - const auto& host_ptr{Memory::GetPointer(*cpu_addr)}; + const auto& host_ptr{memory_manager.GetPointer(gpu_addr)}; if (cache) { auto entry = TryGet(host_ptr); if (entry) { @@ -54,8 +52,8 @@ GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, std::size_t size buffer_offset += size; if (cache) { - auto entry = std::make_shared<CachedBufferEntry>(*cpu_addr, size, uploaded_offset, - alignment, host_ptr); + auto entry = std::make_shared<CachedBufferEntry>( + *memory_manager.GpuToCpuAddress(gpu_addr), size, uploaded_offset, alignment, host_ptr); Register(entry); } |