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 | 90243c56fb90d7d74cbef40da3eec97d967c10a2 (patch) | |
| tree | 94d223001196ca9b774a8d018535ba2be8de1b01 /src/video_core/debug_utils/debug_utils.h | |
| parent | e3a8292495cf0fb4297be27c696649dc44e011f0 (diff) | |
| parent | a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f (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 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 |
