diff options
| author | 2016-04-29 08:50:21 +0200 | |
|---|---|---|
| committer | 2016-04-29 08:50:21 +0200 | |
| commit | a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f (patch) | |
| tree | 29f718ef564717329deb8d63e98ca64659ba1aa5 /src/video_core/debug_utils | |
| parent | Debugger fix (diff) | |
| download | yuzu-a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f.tar.gz yuzu-a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f.tar.xz yuzu-a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f.zip | |
Move and rename the MemoryAccesses class to MemoryAccessTracker.
Diffstat (limited to 'src/video_core/debug_utils')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 30 |
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 7df941619..8338cc857 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -206,6 +206,36 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data); | |||
| 206 | 206 | ||
| 207 | void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages); | 207 | void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages); |
| 208 | 208 | ||
| 209 | /** | ||
| 210 | * Used in the vertex loader to merge access records. TODO: Investigate if actually useful. | ||
| 211 | */ | ||
| 212 | class MemoryAccessTracker { | ||
| 213 | /// Combine overlapping and close ranges | ||
| 214 | void SimplifyRanges() { | ||
| 215 | for (auto it = ranges.begin(); it != ranges.end(); ++it) { | ||
| 216 | // NOTE: We add 32 to the range end address to make sure "close" ranges are combined, too | ||
| 217 | auto it2 = std::next(it); | ||
| 218 | while (it2 != ranges.end() && it->first + it->second + 32 >= it2->first) { | ||
| 219 | it->second = std::max(it->second, it2->first + it2->second - it->first); | ||
| 220 | it2 = ranges.erase(it2); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | public: | ||
| 226 | /// Record a particular memory access in the list | ||
| 227 | void AddAccess(u32 paddr, u32 size) { | ||
| 228 | // Create new range or extend existing one | ||
| 229 | ranges[paddr] = std::max(ranges[paddr], size); | ||
| 230 | |||
| 231 | // Simplify ranges... | ||
| 232 | SimplifyRanges(); | ||
| 233 | } | ||
| 234 | |||
| 235 | /// Map of accessed ranges (mapping start address to range size) | ||
| 236 | std::map<u32, u32> ranges; | ||
| 237 | }; | ||
| 238 | |||
| 209 | } // namespace | 239 | } // namespace |
| 210 | 240 | ||
| 211 | } // namespace | 241 | } // namespace |