Let bindless draws take the cheap check once the frame's rechecks are spent #61

Closed
romainhedouin wants to merge 1 commit from upstream-pr/61 into main
romainhedouin commented 2026-11-25 13:14:42 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-25T13:14:42Z.


Bindless draws start with a cheap check ("anything to do for this heap?") and return at once when there is nothing. One of its conditions is the frame at which queued texture rechecks are next due. Once a frame's recheck quota (32) was used up, that value was still set to a due frame (≤ the current one), so the cheap check never passed again for the rest of the frame: every later bindless draw took the recording flag, read the clock twice and tried the heap's lock, only to find it could not recheck anything. Now, when the quota is spent, the next due frame is set to the next frame. Which textures are rechecked, and when, is unchanged.

Per bindless draw after the frame's quota is spent Before After
Locked atomic operations 3 0
Clock reads 2 0
Draws taking the full path (model, 2.7 M draws, ~1% with changed slots) 2,566,366 27,782

The model is a standalone re-implementation of this state machine; over 300 frames and 12 configurations it gave identical uploads, rechecks and queues for the old and new code. Type-checked for Windows (cargo clippy --target x86_64-pc-windows-msvc, with and without --all-features, no new warnings); not run.

Separate finding, not changed here: the recheck pop loop can pop more entries than the remaining quota, and the extra ones are dropped without being re-queued (descriptor/host.rs ~1439 and ~1579), so such a texture is not rechecked again until a slot reaches it or it is rewritten.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5492038412 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/61). Originally posted by [romainhedouin](https://github.com/romainhedouin) on 2026-11-25T13:14:42Z. --- Bindless draws start with a cheap check ("anything to do for this heap?") and return at once when there is nothing. One of its conditions is the frame at which queued texture rechecks are next due. Once a frame's recheck quota (32) was used up, that value was still set to a due frame (≤ the current one), so the cheap check never passed again for the rest of the frame: every later bindless draw took the recording flag, read the clock twice and tried the heap's lock, only to find it could not recheck anything. Now, when the quota is spent, the next due frame is set to the next frame. Which textures are rechecked, and when, is unchanged. | Per bindless draw after the frame's quota is spent | Before | After | |---|---|---| | Locked atomic operations | 3 | 0 | | Clock reads | 2 | 0 | | Draws taking the full path (model, 2.7 M draws, ~1% with changed slots) | 2,566,366 | 27,782 | The model is a standalone re-implementation of this state machine; over 300 frames and 12 configurations it gave identical uploads, rechecks and queues for the old and new code. Type-checked for Windows (`cargo clippy --target x86_64-pc-windows-msvc`, with and without `--all-features`, no new warnings); not run. Separate finding, not changed here: the recheck pop loop can pop more entries than the remaining quota, and the extra ones are dropped without being re-queued (`descriptor/host.rs` ~1439 and ~1579), so such a texture is not rechecked again until a slot reaches it or it is rewritten. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
romainhedouin commented 2026-11-26 22:24:45 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-26T22:24:45Z.


Closing: the recheck quota this PR fixed (recheck_at, RECHECKS) doesn't exist on a-publier, whose texture queue is a different design (texture_slots_due, descriptor/host.rs:1939).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7204653860 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/61#issuecomment-7204653860). Originally posted by [romainhedouin](https://github.com/romainhedouin) on 2026-11-26T22:24:45Z. --- Closing: the recheck quota this PR fixed (`recheck_at`, `RECHECKS`) doesn't exist on `a-publier`, whose texture queue is a different design (`texture_slots_due`, descriptor/host.rs:1939).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Belobug/VIctory-Belobug-AMD!61
No description provided.