Add ATVR to vcache analyzer

ACMR is a good metric in general but the optimal ACMR number for a given
mesh depends on the triangle/vertex ratio - ACMR of 0.5 is impossible to
reach for certain meshes. In contrast, if we assume all vertices are
required by a given mesh, ATVR (average transform to vertex ratio) has
to be at least 1.0 (each vertex is transformed once), and represents the
amount of over-transformation due to vertex cache misses.
This commit is contained in:
Arseny Kapoulkine
2017-05-15 20:44:24 -07:00
parent c6877d2506
commit a12e61baf0
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ void optimize(const Mesh& mesh, const char* name, void (*optf)(Mesh& mesh))
PostTransformCacheStatistics stats = analyzePostTransform(&copy.indices[0], copy.indices.size(), copy.vertices.size(), kCacheSize);
printf("%-10s: ACMR %f in %f msec\n", name, stats.acmr, double(end - start) / CLOCKS_PER_SEC * 1000);
printf("%-10s: ACMR %f ATVR %f in %f msec\n", name, stats.acmr, stats.atvr, double(end - start) / CLOCKS_PER_SEC * 1000);
}
int main(int argc, char** argv)
+2 -1
View File
@@ -47,7 +47,8 @@ struct PostTransformCacheStatistics
{
unsigned int hits, misses;
float hit_percent, miss_percent;
float acmr; // transformed vertices / triangle count
float acmr; // transformed vertices / triangle count; best case 0.5, worst case 3.0, optimum depends on topology
float atvr; // transformed vertices / vertex count; best case 1.0, worse case 6.0, optimum is 1.0 (each vertex is transformed once)
};
// Vertex transform cache analyzer
+1
View File
@@ -29,6 +29,7 @@ namespace
result.miss_percent = 100 * static_cast<float>(result.misses) / index_count;
result.acmr = static_cast<float>(result.misses) / (index_count / 3);
result.atvr = static_cast<float>(result.misses) / vertex_count;
return result;
}