Bind a vertex stream once until its buffer changes #327

Closed
SkippySteve wants to merge 1 commit from fix/vertex-bind into main
SkippySteve commented 2026-11-07 20:57:24 +00:00 (Migrated from github.com)

Summary

  • Every draw looked up all sixteen vertex streams, even when the same buffers were already bound. That lookup under the pool lock was about 8% of replay time in a race; the lock is gone, and the lookup was still done for every stream of every draw.
  • A stream keeps the buffer it found. The next draw reuses it until a new submission starts, or a pool's mirror is created (the Vulkan buffer changes from guest memory to the mirror). A stream whose address or size changed is looked up again.

Test plan

  • python -I -B tests/test_vertex_bind.py passes: the same address, size, and stamp is reused; a different stamp, size, address, or an empty result is not; the stream loop checks that before calling the lookup; making a mirror bumps the stamp
  • Dropping the stamp compare fails the test, and so does leaving the stamp unchanged when a mirror is made
  • CI: "Check a vertex stream is bound once"
## Summary - Every draw looked up all sixteen vertex streams, even when the same buffers were already bound. That lookup under the pool lock was about 8% of replay time in a race; the lock is gone, and the lookup was still done for every stream of every draw. - A stream keeps the buffer it found. The next draw reuses it until a new submission starts, or a pool's mirror is created (the Vulkan buffer changes from guest memory to the mirror). A stream whose address or size changed is looked up again. ## Test plan - [x] `python -I -B tests/test_vertex_bind.py` passes: the same address, size, and stamp is reused; a different stamp, size, address, or an empty result is not; the stream loop checks that before calling the lookup; making a mirror bumps the stamp - [x] Dropping the stamp compare fails the test, and so does leaving the stamp unchanged when a mirror is made - [ ] CI: "Check a vertex stream is bound once"
NotRexed commented 2026-11-07 23:46:30 +00:00 (Migrated from github.com)

Thanks! Applied to main by hand in c3459dc (you're credited as co-author there), tested in a windowed Kokiri run (no new flashes; with #345/#349/#362: 27.1 -> 30.9 fps median). Closing as merged.

Thanks! Applied to main by hand in c3459dc (you're credited as co-author there), tested in a windowed Kokiri run (no new flashes; with #345/#349/#362: 27.1 -> 30.9 fps median). Closing as merged.
Commenting is not possible because the repository is archived.
No description provided.