summaryrefslogtreecommitdiffstats
path: root/src/video_core/debug_utils
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-04-29 15:42:47 +0200
committerbunnei <bunneidev@gmail.com>2016-04-29 15:42:47 +0200
commit90243c56fb90d7d74cbef40da3eec97d967c10a2 (patch)
tree94d223001196ca9b774a8d018535ba2be8de1b01 /src/video_core/debug_utils
parentCommon: Remove section measurement from profiler (#1731) (diff)
parentMove and rename the MemoryAccesses class to MemoryAccessTracker. (diff)
downloadyuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar.gz
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar.bz2
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar.lz
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar.xz
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.tar.zst
yuzu-90243c56fb90d7d74cbef40da3eec97d967c10a2.zip
Diffstat (limited to 'src/video_core/debug_utils')
-rw-r--r--src/video_core/debug_utils/debug_utils.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h
index 56f9bd958..dd0828cee 100644
--- a/src/video_core/debug_utils/debug_utils.h
+++ b/src/video_core/debug_utils/debug_utils.h
@@ -216,6 +216,36 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data);
void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages);
+/**
+ * Used in the vertex loader to merge access records. TODO: Investigate if actually useful.
+ */
+class MemoryAccessTracker {
+ /// Combine overlapping and close ranges
+ void SimplifyRanges() {
+ for (auto it = ranges.begin(); it != ranges.end(); ++it) {
+ // NOTE: We add 32 to the range end address to make sure "close" ranges are combined, too
+ auto it2 = std::next(it);
+ while (it2 != ranges.end() && it->first + it->second + 32 >= it2->first) {
+ it->second = std::max(it->second, it2->first + it2->second - it->first);
+ it2 = ranges.erase(it2);
+ }
+ }
+ }
+
+public:
+ /// Record a particular memory access in the list
+ void AddAccess(u32 paddr, u32 size) {
+ // Create new range or extend existing one
+ ranges[paddr] = std::max(ranges[paddr], size);
+
+ // Simplify ranges...
+ SimplifyRanges();
+ }
+
+ /// Map of accessed ranges (mapping start address to range size)
+ std::map<u32, u32> ranges;
+};
+
} // namespace
} // namespace