Skip to content

Commit 331f1ce

Browse files
committed
demo: Allow using METIS only for clusterization
To make it easier to test different algorithms in isolation, METIS envvar is now a bitmask, where 1 enables partitioning and 2 enables clustering, so METIS=3 enables both.
1 parent 4e1f0a5 commit 331f1ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

demo/nanite.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static std::vector<Cluster> clusterizeMetis(const std::vector<Vertex>& vertices,
232232

233233
static std::vector<Cluster> clusterize(const std::vector<Vertex>& vertices, const std::vector<unsigned int>& indices)
234234
{
235-
if (METIS >= 2)
235+
if (METIS & 2)
236236
return clusterizeMetis(vertices, indices);
237237

238238
const size_t max_vertices = 192; // TODO: depends on kClusterSize, also may want to dial down for mesh shaders
@@ -346,7 +346,7 @@ static std::vector<std::vector<int> > partitionMetis(const std::vector<Cluster>&
346346

347347
static std::vector<std::vector<int> > partition(const std::vector<Cluster>& clusters, const std::vector<int>& pending, const std::vector<unsigned int>& remap)
348348
{
349-
if (METIS >= 1)
349+
if (METIS & 1)
350350
return partitionMetis(clusters, pending, remap);
351351

352352
(void)remap;
@@ -515,7 +515,7 @@ void nanite(const std::vector<Vertex>& vertices, const std::vector<unsigned int>
515515
if (METIS)
516516
{
517517
if (loadMetis())
518-
printf("using metis for %s\n", METIS >= 2 ? "clustering and partition" : "partition only");
518+
printf("using metis for %s\n", (METIS & 3) == 3 ? "clustering and partition" : ((METIS & 1) ? "partition only" : "clustering only"));
519519
else
520520
printf("metis library is not available\n"), METIS = 0;
521521
}

0 commit comments

Comments
 (0)