fix: preserve MXCSR around earcut triangulation to support UE5 builds…#1386
fix: preserve MXCSR around earcut triangulation to support UE5 builds…#1386Johnly1986 wants to merge 1 commit into
Conversation
… 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.
|
@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! |
|
Hi @Johnly1986, can you make sure to fill out the Contributor License Agreement? We're not seeing your username in our database, which prevents us from giving this a review. |
|
Hi @j9liu , I've just signed the CLA — could you give it a recheck when you get a moment? Thanks! 🙏 |
|
Confirmed that we received your CLA, thanks @Johnly1986! We'll take a look when we get the chance. |
|
@Johnly1986 since this is an Unreal-specific problem (mostly), would it be reasonable to change the mode at the start of each task in cesium-unreal and restore it at the end? So here: My thinking is:
|
… 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
CHANGES.mdwith a short summary of my change (for user-facing changes).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:
CHANGES.mdto make sure they accurately cover the work in this PR.