pretransformanalyzer: Add bytes_fetched stat

All other analyzers expose absolute metrics and compute relative metrics
based on that; do the same for pretransform analyzer and expose the
number of bytes fetched from memory.
This commit is contained in:
Arseny Kapoulkine
2017-05-25 07:16:48 -07:00
parent 1a11027ea5
commit cd3e6e0e5e
2 changed files with 4 additions and 4 deletions
+2 -1
View File
@@ -73,7 +73,8 @@ OverdrawStatistics analyzeOverdraw(const unsigned int* indices, size_t index_cou
struct PreTransformCacheStatistics
{
float overfetch;
unsigned int bytes_fetched;
float overfetch; // fetched bytes / vertex buffer size; best case 1.0 (each byte is fetched once)
};
// Vertex fetch cache analyzer
+2 -3
View File
@@ -15,7 +15,6 @@ namespace
// simple direct mapped cache; on typical mesh data this is close to 4-way cache, and this model is a gross approximation anyway
size_t cache[kCacheSize / kCacheLine] = {};
size_t fetched = 0;
for (size_t i = 0; i < index_count; ++i)
{
@@ -34,12 +33,12 @@ namespace
size_t line = tag % (sizeof(cache) / sizeof(cache[0]));
// we store +1 since cache is filled with 0 by default
fetched += cache[line] != tag + 1;
result.bytes_fetched += (cache[line] != tag + 1) * kCacheLine;
cache[line] = tag + 1;
}
}
result.overfetch = static_cast<float>(fetched * kCacheLine) / static_cast<float>(vertex_count * vertex_size);
result.overfetch = static_cast<float>(result.bytes_fetched) / static_cast<float>(vertex_count * vertex_size);
return result;
}