diff options
author | bunnei <bunneidev@gmail.com> | 2023-07-11 03:54:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 03:54:19 +0200 |
commit | ce7c418e0cc05d92c18ad69c7cb37fecfa71b037 (patch) | |
tree | ea1852111c1b3c3c340608ae518fc8711a4fcfe3 /src/video_core/memory_manager.h | |
parent | Merge pull request #11050 from SuperSamus/sdl-button-labels (diff) | |
parent | Fix ScratchBuffer moves (diff) | |
download | yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.gz yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.bz2 yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.lz yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.xz yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.zst yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.zip |
Diffstat (limited to 'src/video_core/memory_manager.h')
-rw-r--r-- | src/video_core/memory_manager.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 4202c26ff..9b311b9e5 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h @@ -15,6 +15,7 @@ #include "common/range_map.h" #include "common/scratch_buffer.h" #include "common/virtual_buffer.h" +#include "core/memory.h" #include "video_core/cache_types.h" #include "video_core/pte_kind.h" @@ -62,6 +63,20 @@ public: [[nodiscard]] u8* GetPointer(GPUVAddr addr); [[nodiscard]] const u8* GetPointer(GPUVAddr addr) const; + template <typename T> + [[nodiscard]] T* GetPointer(GPUVAddr addr) { + const auto address{GpuToCpuAddress(addr)}; + if (!address) { + return {}; + } + return memory.GetPointer(*address); + } + + template <typename T> + [[nodiscard]] const T* GetPointer(GPUVAddr addr) const { + return GetPointer<T*>(addr); + } + /** * ReadBlock and WriteBlock are full read and write operations over virtual * GPU Memory. It's important to use these when GPU memory may not be continuous @@ -139,6 +154,9 @@ public: void FlushCaching(); + const u8* GetSpan(const GPUVAddr src_addr, const std::size_t size) const; + u8* GetSpan(const GPUVAddr src_addr, const std::size_t size); + private: template <bool is_big_pages, typename FuncMapped, typename FuncReserved, typename FuncUnmapped> inline void MemoryOperation(GPUVAddr gpu_src_addr, std::size_t size, FuncMapped&& func_mapped, |