Skip to content

fix: preserve MXCSR around earcut triangulation to support UE5 builds…#1386

Open
Johnly1986 wants to merge 1 commit into
CesiumGS:mainfrom
Johnly1986:main
Open

fix: preserve MXCSR around earcut triangulation to support UE5 builds…#1386
Johnly1986 wants to merge 1 commit into
CesiumGS:mainfrom
Johnly1986:main

Conversation

@Johnly1986
Copy link
Copy Markdown

@Johnly1986 Johnly1986 commented Jun 3, 2026

… UE5 enables SSE DAZ (Denormals Are Zero) and FTZ (Flush To Zero) MXCSR flags on worker threads in packaged Development/Shipping builds. These flags cause mapbox::earcut's floating-point geometry predicates (signed area, point-in-triangle, etc.) to flush denormal intermediate values to zero, producing incorrect triangulation results for polygons with near-collinear vertices.

Description

Issue number or link

Author checklist

  • I have submitted a Contributor License Agreement (only needed once).
  • I have done a full self-review of my code.
  • I have updated CHANGES.md with a short summary of my change (for user-facing changes).
  • I have added or updated unit tests to ensure consistent code coverage as necessary.
  • I have updated the documentation as necessary.

Remaining Tasks

Testing plan

Reviewer checklist

Thank you for taking the time to review this PR. By approving a PR you are taking as much responsibility for these changes as the author.

As you review, please go through the checklist below:

  • Review and run all parts of the test plan on this branch and verify it matches expectations.
    • If the issue is a bug please make sure you can reproduce the bug in the main branch and then checkout this branch to make sure it actually solved the issue.
  • Review the code and make sure you do not have any remaining questions or concerns. You should understand the code change and the chosen approach. If you are not confident or have doubts about the code, please do not hesitate to ask questions.
  • Review the unit tests and make sure there are no missing tests or edge cases.
  • Review documentation changes and updates to CHANGES.md to make sure they accurately cover the work in this PR.
  • Verify that the Contributor License Agreement has been submitted, if needed.

… UE5 enables SSE DAZ (Denormals Are Zero) and FTZ (Flush To Zero) MXCSR flags on worker threads in packaged Development/Shipping builds. These flags cause mapbox::earcut's floating-point geometry predicates (signed area, point-in-triangle, etc.) to flush denormal intermediate values to zero, producing incorrect triangulation results for polygons with near-collinear vertices.
@azrogers
Copy link
Copy Markdown
Contributor

azrogers commented Jun 3, 2026

@Johnly1986 Thanks for the PR! Can you run down the author checklist in the template there? Particularly we need you to fill out the Contributor License Agreement - otherwise we can't take a look at your code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants