Skip to content

Commit 2e06eba

Browse files
committed
clusterizer: Use strict comparison for maxss codegen
Using >= generates a series of comparisons on x64, whereas using > matches maxss pattern. Also fix a couple comments that were written before sparse adjacency builder was split.
1 parent fdbbe7a commit 2e06eba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/clusterizer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,9 @@ static void buildTriangleAdjacencySparse(TriangleAdjacency2& adjacency, const un
101101
for (size_t i = 0; i < index_count; ++i)
102102
adjacency.counts[indices[i]]++;
103103

104-
// fill offset table
104+
// fill offset table; uses sparse_seen bit to tag visited vertices
105105
unsigned int offset = 0;
106106

107-
// when using sparse mode this pass uses sparse_seen bit to tag visited vertices
108107
for (size_t i = 0; i < index_count; ++i)
109108
{
110109
unsigned int v = indices[i];
@@ -130,7 +129,7 @@ static void buildTriangleAdjacencySparse(TriangleAdjacency2& adjacency, const un
130129
}
131130

132131
// fix offsets that have been disturbed by the previous pass
133-
// when using sparse mode this pass also fixes counts (that were marked with sparse_seen)
132+
// also fix counts (that were marked with sparse_seen by the first pass)
134133
for (size_t i = 0; i < index_count; ++i)
135134
{
136135
unsigned int v = indices[i];
@@ -242,8 +241,8 @@ static float getDistance(float dx, float dy, float dz, bool aa)
242241
return sqrtf(dx * dx + dy * dy + dz * dz);
243242

244243
float rx = fabsf(dx), ry = fabsf(dy), rz = fabsf(dz);
245-
float rxy = rx >= ry ? rx : ry;
246-
return rxy >= rz ? rxy : rz;
244+
float rxy = rx > ry ? rx : ry;
245+
return rxy > rz ? rxy : rz;
247246
}
248247

249248
static float getMeshletScore(float distance, float spread, float cone_weight, float expected_radius)

0 commit comments

Comments
 (0)