Skip to content

runtime: Support subdivision on managed threads. - #1

Merged
freezy merged 1 commit into
mainfrom
fix/threaded-subdivision-allocator
Aug 21, 2026
Merged

runtime: Support subdivision on managed threads.#1
freezy merged 1 commit into
mainfrom
fix/threaded-subdivision-allocator

Conversation

@freezy

@freezy freezy commented Aug 21, 2026

Copy link
Copy Markdown
Member
  • Replace per-subdivision Allocator.Temp arrays with reusable, allocator-owned buffers in NativeOctree<T> and NativeQuadtree<T>.
  • Dispose the new buffers through both synchronous and job-dependent disposal paths.
  • Add EditMode regression tests that force recursive subdivision from a plain managed thread.
  • Enable package tests in the development project and document the allocator scope.

Motivation

VPE rebuilds its kinematic octree on a dedicated managed simulation thread. NativeTrees previously allocated subdivision scratch memory with Allocator.Temp, which Unity only permits on its main thread and job workers. Once a node exceeded objectsPerNode, subdivision threw an allocator exception.

The reusable buffer removes that thread restriction and avoids repeated allocations during recursive subdivision.

@freezy freezy self-assigned this Aug 21, 2026
@freezy
freezy merged commit 87c1474 into main Aug 21, 2026
4 checks passed
@freezy
freezy deleted the fix/threaded-subdivision-allocator branch August 21, 2026 21:24
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.

1 participant