mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #2378] [MERGED] indirect clamp: a draw record of 2^23 vertices or more runs empty and free (RT-INDIRECT-DRAW-UNFILLED-COUNT) #2383
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2383
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2378
Author: @kawaii-shakal
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:indirect-draw-unfilled-count📝 Commits (2)
f324b94indirect clamp: a draw record of 2^23 vertices or more runs empty and free (RT-INDIRECT-DRAW-UNFILLED-COUNT)41332d4Merge remote-tracking branch 'upstream/main' into indirect-draw-unfilled-count📊 Changes
5 files changed (+294 additions, -239 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+5 -2)📝
runtime/src/indirect_clamp.comp(+8 -1)📝
runtime/src/indirect_clamp_spv.h(+229 -223)📝
runtime/src/vulkan_indirect_clamp.h(+3 -0)📝
runtime/test/indirect_clamp_test.cpp(+49 -13)📄 Description
Claimed in the coordination issue as: RT-INDIRECT-DRAW-UNFILLED-COUNT
Depends on: #2230 (conflicts only in the generated
runtime/src/indirect_clamp_spv.h: whichever of the two landssecond regenerates it from the merged
indirect_clamp.comp)What and why
indirect_clamp.comptreats a draw record as unfilled only when all of its words are 0xFFFFFFFF. A slot with agarbage count and its other words set is cut to 2^24 vertices and charged 2^24 units against the list's 2^27 budget.
Eight such slots use up the budget, and every real draw after them in the list runs empty. That shows up as objects
missing for a frame, or as flicker.
A census in codec-d/cool_fox's fork of VIctory found 90 records of 2^24 vertices in one list of the title. That fork
treats 2^23 vertices an instance or more as unfilled (its
docs/findings.mdandcrates/victory-gpu/src/indirect.rs).It suspects such records behind outdoor flicker; nothing in this PR confirms that link. No code of it is used.
With this PR, a draw or indexed-draw record of 2^23 or more vertices (or indices) an instance runs empty, keeps its
locations and charges nothing. It is counted as clamped and zeroed, as unfilled slots already are. Draws under 2^23 are
unchanged, including the 2^26 vertex-instance bound.
indirect_clamp.comp:unfilled_draw = 2^23; such a record's count and instances become 0, at cost 0.vulkan_indirect_clamp.h:indirect_clamp_unfilled_drawfor the tests.indirect_clamp_spv.h: regenerated with glslangValidator 15.1.0 (-V --target-env vulkan1.2 -Os --spirv-val).docs/d3d12_vulkan.md: the clamp's paragraph says so.Tested
indirect_clamp_test. The old garbage-count cases now expect an empty record. New cases:building the test against the old
indirect_clamp_spv.h: 2c fails). With this one it runs.The list-budget case now spends the budget with a real 2^22 x 16 draw instead of a 2^24 one.
Full
cteston the branch merged with current main (fbf100b1): 112 of 112 pass.GPUs tested: Mesa lavapipe (llvmpipe, LLVM 19.1.7), Ubuntu 24.04 container. Not run on a hardware GPU or with the game.
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: notranslator change)
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.