diff options
| author | bunnei <bunneidev@gmail.com> | 2016-04-29 09:42:47 -0400 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2016-04-29 09:42:47 -0400 |
| commit | df1d6ff8a1e143457fdfdc5b3e056bdf7f4c41d2 (patch) | |
| tree | 94d223001196ca9b774a8d018535ba2be8de1b01 /src/video_core/debug_utils/debug_utils.h | |
| parent | 2396b01d5d19c137683e6fb237d71e0a02a96e77 (diff) | |
| parent | 9f1cffa3e9bc282dc339d877f4558fb518bf35ea (diff) | |
Merge pull request #1730 from hrydgard/vertex-loader
* Remove late accesses to attribute_config
* Refactor: Extract VertexLoader from command_processor.cpp.
Preparation for a similar concept to Dolphin or PPSSPP. These can be JIT-ed and cached.
* Move "&" to their proper place, add missing includes and make some properly relative.
* Don't keep base_address in the loader, it doesn't belong there (with it, the loader can't be cached).
* Optimize the vertex loader, nearly doubling its speed.
* Debugger fix
* Move and rename the MemoryAccesses class to MemoryAccessTracker.
Diffstat (limited to 'src/video_core/debug_utils/debug_utils.h')
| -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 56f9bd9589..dd0828ceef 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 |
