mirror of
https://github.com/openharmony/third_party_meshoptimizer.git
synced 2026-07-19 20:03:59 -04:00
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:
+1
-1
@@ -139,7 +139,7 @@ void optimize(const Mesh& mesh, const char* name, void (*optf)(Mesh& mesh))
|
||||
|
||||
PostTransformCacheStatistics stats = analyzePostTransform(©.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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user