forked from 1b-agent/opencadstudio-upstream
The batch split at a fixed 6M-vertex cap that assumed 40 B/vertex, but MeshVertex grew to 52 B when the double-single `position_low` field was added — so a full chunk was 6M x 52 = 312 MB, past wgpu's 256 MB max_buffer_size, and Device::create_buffer panicked on large models. Derive the caps from device.limits().max_buffer_size and the real vertex size, bound both the vertex buffer and the (fatter) wire-index buffer, and split any single mesh too large for one chunk into triangle-soup sub-chunks so no batch buffer can exceed the device limit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>