summaryrefslogtreecommitdiff
path: root/src/video_core/debug_utils
diff options
context:
space:
mode:
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);
216 216
217void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages); 217void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages);
218 218
219/**
220 * Used in the vertex loader to merge access records. TODO: Investigate if actually useful.
221 */
222class MemoryAccessTracker {
223 /// Combine overlapping and close ranges
224 void SimplifyRanges() {
225 for (auto it = ranges.begin(); it != ranges.end(); ++it) {
226 // NOTE: We add 32 to the range end address to make sure "close" ranges are combined, too
227 auto it2 = std::next(it);
228 while (it2 != ranges.end() && it->first + it->second + 32 >= it2->first) {
229 it->second = std::max(it->second, it2->first + it2->second - it->first);
230 it2 = ranges.erase(it2);
231 }
232 }
233 }
234
235public:
236 /// Record a particular memory access in the list
237 void AddAccess(u32 paddr, u32 size) {
238 // Create new range or extend existing one
239 ranges[paddr] = std::max(ranges[paddr], size);
240
241 // Simplify ranges...
242 SimplifyRanges();
243 }
244
245 /// Map of accessed ranges (mapping start address to range size)
246 std::map<u32, u32> ranges;
247};
248
219} // namespace 249} // namespace
220 250
221} // namespace 251} // namespace