Skip to content

Commit

Permalink
demo: Add average strip length to demo output
Browse files Browse the repository at this point in the history
This is a similar efficiency measure to strip index count and can be
used to compare the results to other published algorithms. For
simplicity, we only measure the strip length when restart indices are
used; the results should not depend on whether that's the case (compared
to strip index percentage which does).
  • Loading branch information
zeux committed Oct 18, 2024
1 parent 7bb503f commit b0cc223
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ void stripify(const Mesh& mesh, bool use_restart, char desc)
strip.resize(meshopt_stripify(&strip[0], &mesh.indices[0], mesh.indices.size(), mesh.vertices.size(), restart_index));
double end = timestamp();

size_t restarts = 0;
for (size_t i = 0; i < strip.size(); ++i)
restarts += use_restart && strip[i] == restart_index;

Mesh copy = mesh;
copy.indices.resize(meshopt_unstripify(&copy.indices[0], &strip[0], strip.size(), restart_index));
assert(copy.indices.size() <= meshopt_unstripifyBound(strip.size()));
Expand All @@ -877,9 +881,10 @@ void stripify(const Mesh& mesh, bool use_restart, char desc)
meshopt_VertexCacheStatistics vcs_amd = meshopt_analyzeVertexCache(&copy.indices[0], mesh.indices.size(), mesh.vertices.size(), 14, 64, 128);
meshopt_VertexCacheStatistics vcs_intel = meshopt_analyzeVertexCache(&copy.indices[0], mesh.indices.size(), mesh.vertices.size(), 128, 0, 0);

printf("Stripify%c: ACMR %f ATVR %f (NV %f AMD %f Intel %f); %d strip indices (%.1f%%) in %.2f msec\n",
printf("Stripify%c: ACMR %f ATVR %f (NV %f AMD %f Intel %f); %.1f run avg, %d strip indices (%.1f%%) in %.2f msec\n",
desc,
vcs.acmr, vcs.atvr, vcs_nv.atvr, vcs_amd.atvr, vcs_intel.atvr,
use_restart ? double(strip.size() - restarts) / double(restarts + 1) : 0,
int(strip.size()), double(strip.size()) / double(mesh.indices.size()) * 100,
(end - start) * 1000);
}
Expand Down

0 comments on commit b0cc223

Please sign in to comment.