diff options
| author | 2016-04-29 08:50:21 +0200 | |
|---|---|---|
| committer | 2016-04-29 08:50:21 +0200 | |
| commit | a86d7cacc1f56c6e8ff5f046ba7e2477e92d873f (patch) | |
| tree | 29f718ef564717329deb8d63e98ca64659ba1aa5 | |
| 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 '')
| -rw-r--r-- | src/video_core/command_processor.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 30 | ||||
| -rw-r--r-- | src/video_core/vertex_loader.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/vertex_loader.h | 30 |
4 files changed, 35 insertions, 32 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 373fb51ad..f181f75d7 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -224,7 +224,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | MemoryAccesses memory_accesses; | 227 | DebugUtils::MemoryAccessTracker memory_accesses; |
| 228 | 228 | ||
| 229 | // Simple circular-replacement vertex cache | 229 | // Simple circular-replacement vertex cache |
| 230 | // The size has been tuned for optimal balance between hit-rate and the cost of lookup | 230 | // The size has been tuned for optimal balance between hit-rate and the cost of lookup |
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 |
diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp index 4784817f4..8a3d91896 100644 --- a/src/video_core/vertex_loader.cpp +++ b/src/video_core/vertex_loader.cpp | |||
| @@ -12,8 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include "core/memory.h" | 13 | #include "core/memory.h" |
| 14 | 14 | ||
| 15 | #include "debug_utils/debug_utils.h" | 15 | #include "video_core/debug_utils/debug_utils.h" |
| 16 | |||
| 17 | #include "video_core/pica.h" | 16 | #include "video_core/pica.h" |
| 18 | #include "video_core/pica_state.h" | 17 | #include "video_core/pica_state.h" |
| 19 | #include "video_core/pica_types.h" | 18 | #include "video_core/pica_types.h" |
| @@ -63,7 +62,7 @@ void VertexLoader::Setup(const Pica::Regs& regs) { | |||
| 63 | } | 62 | } |
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, MemoryAccesses& memory_accesses) { | 65 | void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, DebugUtils::MemoryAccessTracker& memory_accesses) { |
| 67 | for (int i = 0; i < num_total_attributes; ++i) { | 66 | for (int i = 0; i < num_total_attributes; ++i) { |
| 68 | if (vertex_attribute_elements[i] != 0) { | 67 | if (vertex_attribute_elements[i] != 0) { |
| 69 | // Load per-vertex data from the loader arrays | 68 | // Load per-vertex data from the loader arrays |
diff --git a/src/video_core/vertex_loader.h b/src/video_core/vertex_loader.h index 7267ea9c6..ff42d1596 100644 --- a/src/video_core/vertex_loader.h +++ b/src/video_core/vertex_loader.h | |||
| @@ -5,40 +5,14 @@ | |||
| 5 | 5 | ||
| 6 | #include "video_core/pica.h" | 6 | #include "video_core/pica.h" |
| 7 | #include "video_core/shader/shader.h" | 7 | #include "video_core/shader/shader.h" |
| 8 | #include "video_core/debug_utils/debug_utils.h" | ||
| 8 | 9 | ||
| 9 | namespace Pica { | 10 | namespace Pica { |
| 10 | 11 | ||
| 11 | class MemoryAccesses { | ||
| 12 | /// Combine overlapping and close ranges | ||
| 13 | void SimplifyRanges() { | ||
| 14 | for (auto it = ranges.begin(); it != ranges.end(); ++it) { | ||
| 15 | // NOTE: We add 32 to the range end address to make sure "close" ranges are combined, too | ||
| 16 | auto it2 = std::next(it); | ||
| 17 | while (it2 != ranges.end() && it->first + it->second + 32 >= it2->first) { | ||
| 18 | it->second = std::max(it->second, it2->first + it2->second - it->first); | ||
| 19 | it2 = ranges.erase(it2); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | public: | ||
| 25 | /// Record a particular memory access in the list | ||
| 26 | void AddAccess(u32 paddr, u32 size) { | ||
| 27 | // Create new range or extend existing one | ||
| 28 | ranges[paddr] = std::max(ranges[paddr], size); | ||
| 29 | |||
| 30 | // Simplify ranges... | ||
| 31 | SimplifyRanges(); | ||
| 32 | } | ||
| 33 | |||
| 34 | /// Map of accessed ranges (mapping start address to range size) | ||
| 35 | std::map<u32, u32> ranges; | ||
| 36 | }; | ||
| 37 | |||
| 38 | class VertexLoader { | 12 | class VertexLoader { |
| 39 | public: | 13 | public: |
| 40 | void Setup(const Pica::Regs& regs); | 14 | void Setup(const Pica::Regs& regs); |
| 41 | void LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, MemoryAccesses& memory_accesses); | 15 | void LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, DebugUtils::MemoryAccessTracker& memory_accesses); |
| 42 | 16 | ||
| 43 | int GetNumTotalAttributes() const { return num_total_attributes; } | 17 | int GetNumTotalAttributes() const { return num_total_attributes; } |
| 44 | 18 | ||