Repository navigation
recastnavigation-m 1.6.0.2: stable sorts, the same BV tree and contours on every platform - #1
Merged
Merged
Conversation
…rs on every platform dtCreateNavMeshData's BV tree (compareItemX/Y/Z) and rcBuildContours' hole merging (compareHoles, compareDiagDist) sorted with the C library's qsort, which is not stable: glibc, macOS, the Windows UCRT and emscripten's musl order equal keys differently, so a mesh whose BV items or contour holes and diagonals tie (common on a grid) had different bytes by platform, and a crowd on it walked differently (a consumer's pinned crowd hash failed on the Web and Windows rows only). - patches/0004 (upstream-worthy): the five calls use std::stable_sort with the same comparators; a stable sort's order is fixed by the comparator and the input, the same everywhere. Pre-applied in upstream/; documents.json records both files' tarball and patched checksums and the patch. - tests/navmesh_test.cpp: TiledHallTies, a hall tiled in four with a grid of pillars and four closed rooms, eight agents walked across it; the tiles' bytes pinned at 0x3cfa3346e30b08f1, the crowd at 0x858c19b1c3879c98. Without the patch the tiles hash 0x3cfa3346e30b08f1 on Linux x86-64 (glibc) and 0x396a14792154130e on wasm32-emscripten; with it both give 0x3cfa3346e30b08f1, in dev and release. The earlier mesh and crowd hashes are unchanged. - mcpp.toml: version 1.6.0.2, the build comment on the stable sorts; READMEs.
Sunrisepeak
pushed a commit
to mcpplibs/mcpp-index
that referenced
this pull request
Nov 15, 2026
… platform (stable sorts) recastnavigation-m mwrap-1.6.0.2 (mcpplibs/recastnavigation-m#1): patches/0004 makes the BV tree and the contours' hole merging sort with std::stable_sort instead of qsort, which orders equal keys differently by C library; a new test pins a tiled grid hall's bytes and a crowd on it, the same on every CI row. GLOBAL and CN archives are byte-identical (sha256 7e08fd3902ca9e5e57d46151a8909b401bda5fd3bac1e106397b98391dd7f822). The consumer test recastnavigation-path moves to 1.6.0.2 (its pinned hashes are unchanged).
Sunrisepeak
added a commit
to mcpplibs/mcpp-index
that referenced
this pull request
Nov 15, 2026
… platform (stable sorts) (#800) recastnavigation-m mwrap-1.6.0.2 (mcpplibs/recastnavigation-m#1): patches/0004 makes the BV tree and the contours' hole merging sort with std::stable_sort instead of qsort, which orders equal keys differently by C library; a new test pins a tiled grid hall's bytes and a crowd on it, the same on every CI row. GLOBAL and CN archives are byte-identical (sha256 7e08fd3902ca9e5e57d46151a8909b401bda5fd3bac1e106397b98391dd7f822). The consumer test recastnavigation-path moves to 1.6.0.2 (its pinned hashes are unchanged). Co-authored-by: Sunrisepeak <speakshen@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
patches/0004: the BV tree and the contours' hole merging sort with std::stable_sort instead of the C library's qsort (not stable; glibc, macOS, the UCRT and musl order equal keys differently, so a mesh with ties had different bytes by platform). New test TiledHallTies pins the tiled mesh's bytes (0x3cfa3346e30b08f1) and a crowd on it (0x858c19b1c3879c98); without the patch wasm32 gave 0x396a14792154130e. Version 1.6.0.2.