meshoptimizer: Update to 1.1.1

(cherry picked from commit f2b42696965815c7d1de1c4303b25e7b5d0ea7b8)
This commit is contained in:
Jakub Marcowski authored and Thaddeus Crews committed 2026-06-30 09:15:12 -05:00
1 parent e46e7180e9
commit 5672bfd78d
6 files changed
+17 -7

No files matched your search

+1 -1
View File
@@ -720,7 +720,7 @@ Update instructions:
## meshoptimizer
- Upstream: https://github.com/zeux/meshoptimizer
- Version: 1.1 (dc9d09ed83e1004aef47a1c3c597e0ec64848a37, 2026)
- Version: 1.1.1 (b22872835dbabc56a6e4a366ea9917f62b7daf1a, 2026)
- License: MIT
Files extracted from upstream repository:
+4
View File
@@ -1,6 +1,8 @@
// This file is part of meshoptimizer library; see meshoptimizer.h for version/license details
#include "meshoptimizer.h"
#include <assert.h>
#ifdef MESHOPTIMIZER_ALLOC_EXPORT
meshopt_Allocator::Storage& meshopt_Allocator::storage()
{
@@ -11,6 +13,8 @@ meshopt_Allocator::Storage& meshopt_Allocator::storage()
void meshopt_setAllocator(void* (MESHOPTIMIZER_ALLOC_CALLCONV* allocate)(size_t), void (MESHOPTIMIZER_ALLOC_CALLCONV* deallocate)(void*))
{
assert(allocate && deallocate);
meshopt_Allocator::Storage& s = meshopt_Allocator::storage();
s.allocate = allocate;
s.deallocate = deallocate;
+7 -1
View File
@@ -491,7 +491,7 @@ void meshopt_optimizeMeshletLevel(unsigned int* meshlet_vertices, size_t vertex_
// if subsequent triangles don't share edges ca or bc, we can rotate the triangle to fix this
bool needab = false, needbc = false, needca = false;
for (size_t j = i + 1; j < triangle_count && j <= i + 3; ++j)
for (size_t j = i + 1; j < triangle_count && j <= i + cache_cutoff; ++j)
{
unsigned char oa = indices[j * 3 + 0], ob = indices[j * 3 + 1], oc = indices[j * 3 + 2];
@@ -513,6 +513,12 @@ void meshopt_optimizeMeshletLevel(unsigned int* meshlet_vertices, size_t vertex_
unsigned char t = c;
c = b, b = a, a = t;
}
else if (!needab && needbc && !needca)
{
// abc -> cab: put bc at most recent FIFO position
unsigned char t = c;
c = b, b = a, a = t;
}
}
indices[i * 3 + 0] = a, indices[i * 3 + 1] = b, indices[i * 3 + 2] = c;
+3 -3
View File
@@ -1215,7 +1215,7 @@ template <typename T>
inline void meshopt_remapIndexBuffer(T* destination, const T* indices, size_t index_count, const unsigned int* remap)
{
meshopt_IndexAdapter<T> in(NULL, indices, indices ? index_count : 0);
meshopt_IndexAdapter<T> out(destination, 0, index_count);
meshopt_IndexAdapter<T> out(destination, NULL, index_count);
meshopt_remapIndexBuffer(out.data, indices ? in.data : NULL, index_count, remap);
}
@@ -1263,7 +1263,7 @@ inline size_t meshopt_generateProvokingIndexBuffer(T* destination, unsigned int*
meshopt_IndexAdapter<T> out(destination, NULL, index_count);
size_t bound = vertex_count + (index_count / 3);
assert(size_t(T(bound - 1)) == bound - 1); // bound - 1 must fit in T
assert(bound == 0 || size_t(T(bound - 1)) == bound - 1); // bound - 1 must fit in T
(void)bound;
return meshopt_generateProvokingIndexBuffer(out.data, reorder, in.data, index_count, vertex_count);
@@ -1435,7 +1435,7 @@ template <typename T>
inline size_t meshopt_unstripify(T* destination, const T* indices, size_t index_count, T restart_index)
{
meshopt_IndexAdapter<T> in(NULL, indices, index_count);
meshopt_IndexAdapter<T> out(destination, NULL, (index_count - 2) * 3);
meshopt_IndexAdapter<T> out(destination, NULL, index_count == 0 ? 0 : (index_count - 2) * 3);
return meshopt_unstripify(out.data, in.data, index_count, unsigned(restart_index));
}
+1 -1
View File
@@ -172,7 +172,7 @@ static float transformTriangles(float* triangles, const unsigned int* indices, s
extent = (maxv[1] - minv[1]) < extent ? extent : (maxv[1] - minv[1]);
extent = (maxv[2] - minv[2]) < extent ? extent : (maxv[2] - minv[2]);
float scale = kViewport / extent;
float scale = extent == 0.f ? 0.f : kViewport / extent;
for (size_t i = 0; i < index_count; ++i)
{
+1 -1
View File
@@ -1416,7 +1416,7 @@ inline v128_t unzigzag16(v128_t v)
SIMD_TARGET
inline v128_t rotate32(v128_t v, int r)
{
return wasm_v128_or(wasm_i32x4_shl(v, r), wasm_i32x4_shr(v, 32 - r));
return wasm_v128_or(wasm_i32x4_shl(v, r), wasm_u32x4_shr(v, 32 - r));
}
#endif