mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
The map_async callback fires on the render thread inside Queue::submit, so its CPU work (pixel swizzle + buffer copy) blocks the next frame's GPU dispatch. Move the swizzle/send to a dedicated worker thread so submit returns immediately. On wasm (no real threads, !Send Buffer) keep the work inline. While there, replace the per-byte runtime-indexed swizzle loop with chunks_exact and constant indices so LLVM can autovectorize, and add a fast path for Rgba8Unorm that just bytemuck::cast_slice's each row straight into the Vec<Color32>.