Skip to content

fix: prevent browser freeze when tessellating >50k vertices (#8219 )#8555

Open
Nixxx19 wants to merge 1 commit intoprocessing:mainfrom
Nixxx19:nityam/tessellation-freeze-fix
Open

fix: prevent browser freeze when tessellating >50k vertices (#8219 )#8555
Nixxx19 wants to merge 1 commit intoprocessing:mainfrom
Nixxx19:nityam/tessellation-freeze-fix

Conversation

@Nixxx19
Copy link

@Nixxx19 Nixxx19 commented Feb 22, 2026

Resolves #8219

Changes:

  • Added vertex count validation in _processVertices() before calling _tesselateShape() to prevent browser freeze
  • Shows friendly warning message when vertex count exceeds 50,000 vertices
  • Skips tessellation for large shapes and falls back to TRIANGLE_FAN mode so shapes still render
  • Added unit tests to verify warning behavior and normal operation for safe vertex counts

The fix prevents the browser from freezing when libtess tries to tessellate shapes with >65k vertices. The freeze was happening inside libtess during _triangulate(), before any buffer caching logic could run.

Screenshots of the change:

Screenshot 2026-02-22 at 5 22 42 PM

PR Checklist

  • npm run lint passes
  • [Inline reference] is included / updated (not applicable - this is a bug fix)
  • [Unit tests] are included / updated

@welcome
Copy link

welcome bot commented Feb 22, 2026

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

@Nixxx19
Copy link
Author

Nixxx19 commented Feb 25, 2026

@davepagurek @ksen0 whenever you have a chance, could you review this pr? i'd love to hear your feedback.

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.

Browser freeze when creating >65k vertices in draw() loop (no validation or warning)

1 participant