d3d12/gpu: a texture limit no longer adds copies past the card's budget (D3D12-TEXTURE-BUDGET-OVER-GUARD) #3153
Open
Jishnuraj07 wants to merge 1 commit from
upstream-pr/3153 into main
pull from: upstream-pr/3153
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
ProjectLeonida/mandy!3153
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3153"
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?
Imported from ubiquitarianism/leonida. Originally posted by Jishnuraj07 on 2026-12-02T14:30:57Z.
Claimed in the coordination issue as:
D3D12-TEXTURE-BUDGET-OVER-GUARDRelated: #2658 (closed for a merge conflict only; this is its part 1, ported with credit to @olgundemirkan), #2607, #2611, #3121 (8 GB cards over their budget)
What and why
With
LEONIDA_TEXTURE_BUDGET_MBset,resource::room()returnedfilled < limitstraight away and never looked at the card's memory. 8 GB setups set that limit (4,000 MB in #2658's profile) so that characters keep their textures past nine tenths of the budget. As a side effect, host copies of title textures kept being made while the process was already over its DXGI budget: 7,823 MB of a 7,256 MB budget in #2658's 2026-11-29 runs, until the driver faulted.room_for()(d3d12/crates/leonida-gpu/src/resource.rs), so it can be unit-tested without the environmentOnceLocks or a device.filled < limitand the card is under its budget (used < budget). A budget of 0, from an adapter that reports none, counts as no budget there, so the limit alone decides as before.room_percent(). Using the 90 % line would bring back what the limit exists to avoid (untextured characters past nine tenths of the budget).Not in this PR, left to measure in game first: the guard could also count the room kept for render targets and buffer copies, as the share path does. On a ~7.2 GB budget, the 3,072 MB target reserve could starve textures, so that should be an A/B run, not a guess.
Tested
a_texture_limit_stops_at_the_cards_budgetandwithout_a_texture_limit_the_share_of_the_budget_decides.room_for, make the first line of theif let Some(limit) = limitbranchmain'sreturn filled < limit;(so the budget is never looked at).a_texture_limit_stops_at_the_cards_budgetthen fails at the "card at its budget" assert; with the fix it passes. Done by hand on the final code, not withred_green.py, because the new tests callroom_for, which does not exist onmain. (Putting the line back inroom()itself does not compile, sincelimitis anOptionthere and theroom_forcall is the tail expression; thanks @fiestorra.)leonida-gpucrate:cargo test -p leonida-gpu --lib --locked: 698 passed, 0 failed, 59 ignored.cargo test --workspace --exclude xtask --locked --no-fail-fast -- --skip depth_bounds_pipeline_loads_and_filters_draws: all 32 test binaries ok.leonida-loaderconsole_insn::tests::a_clzero_loop_becomes_plain_storesfailed once and then passed on rerun. That crate does not depend onleonida-gpu, so it is a flaky test unrelated to this change.python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdandpython -I tests/test_d3d12_switches.pypass.python -I scripts/check_no_game_data.pyis clean on the changed file.main, andmainalone): not run yet. I will post it here from the RTX 5060 8 GB below, withLEONIDA_TEXTURE_BUDGET_MBset.GPUs tested: NVIDIA GeForce RTX 5060 8 GB, driver 621.47, Windows 11 Pro 26200 (unit tests; the in-game run will follow)
AI-assisted: yes. Claude Opus 5.5 (Claude Code) wrote the change and tests, and a separate read-only Claude Opus 5.5 reviewer agent audited the diff. Its findings (budget 0 blocking every copy, a doc claim to cite, the floor wording) are addressed in this head.
Checklist
main(69cd4106c) and merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:35:12Z.
Review: COMMENTED
Independent check of
f854004donmain69cd4106c. Both stock texture-limit tests passed in the MSVC-target build under Wine 11.22.I also ran the same local probe against the production
resource::room()entry point on both revisions. WithLEONIDA_TEXTURE_BUDGET_MB=4000and a synthetic 7,256 MiB budget,mainstill returned true at exactly 7,256 MiB. The PR accepted 7,000 MiB and denied both 7,256 and 7,823 MiB. A zero budget and a missing memory query still honored the configured texture limit.This verifies the admission decision for a reported budget sample. The live 8 GB rendering run and budget behavior between samples remain unverified in this review. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T15:47:12Z.
Checked here, and the checker's verdict is not what it looks like:
red_green.pysaysgreen fails, and that is an artefact of the tests, not of the change.The red side cannot compile because the new tests call
room_for, which this pull request introduces - so there is no "red" result to compare and the tool stops atgreen fails. Anyone scanning verdicts will read that as "the pull request breaks the crate", and it does not.The green side is green, measured separately on
f854004db:And one thing in the body that does not work as written. It says "putting back only
main'sreturn filled < limit;makesa_texture_limit_stops_at_the_cards_budget[fail]". I tried that literally twice and neither compiles:room(), afterlet limit = texture_budget_bytes();->error[E0308]: mismatched types, because this branch'slimitis not a bare number any more;room_for(...)line ->error[E0317]: if may be missing an else clause, because that line is the function's tail expression.So the revert has to be made inside
room_for's body (make itreturn filled < limit;before the budget is looked at). Worth fixing in the body, because a reviewer will try exactly what it says - and I would rather report that I could not reproduce the red than claim it.What I did not run: the in-game gate. The body says it is not run yet, and this machine cannot run the title.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T15:49:09Z.
Correction to what I said above:
green failsis right, and my explanation of it was wrong.It is this machine, not your change.
cargo test -p leonida-gpu --libonmainhere is 695 passed, 1 failed, and the failure is- the byte-comparison test that fails on this machine's integrated Radeon, because every device test still makes its device with
D3D12CreateDevice(None, ..)(that is what my #2995 fixes). So the green side's suite fails for a reason that has nothing to do withresource.rs, and the checker reports it as it should.What misled me: the tool has a
red does not buildverdict (scripts/red_green.py:541, with its own test attests/test_red_green.py:191), and it printedred does not build: ... cannot find function room_foras well - so the run says both things, and I read the verdict line as if it were about the helper. It was not: it was about the descriptor test. The tool was right and I was not.What stands from above: your two new tests pass individually on
f854004db(a_texture_limit_stops_at_the_cards_budgetandwithout_a_texture_limit..., 1 passed each), and the manual red in your body still does not compile as written -E0308insideroom(),E0317at the call site - so the revert belongs insideroom_for's body.If you want a clean
red then greenfrom the checker on a machine like this one,-p leonida-gpuneeds the device tests on the card (#2995) or--skipon that one test; on a machine without the iGPU it would have saidred then greenorred does not buildand nothing else.AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by Jishnuraj07 on 2026-12-02T16:06:08Z.
Thanks @fiestorra, you're right about the red step: the line has to go inside
room_for, notroom(). The body now says to make the first line of theif let Some(limit) = limitbranchreturn filled < limit;. With that,a_texture_limit_stops_at_the_cards_budgetfails at the "card at its budget" assert, and with the fix it passes.Thanks also for tracking down the
green failsverdict to the device test on the integrated Radeon (#2995) and not this change.Thanks @merzleckeier for the probe against
room()itself, including the budget-0 and no-reading cases.The in-game gate on the RTX 5060 8 GB is still to come.
AI-assisted: yes, Claude Opus 5.5 (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T17:53:37Z.
Ran natively on Windows 11, head
f854004dbmerged into currentmain(45dc41f95, clean merge). Debug build.Suites and red on the merge
cargo test -p leonida-gpu --lib -- --test-threads=4room_for, the limit branch madereturn filled < limit;a_texture_limit_stops_at_the_cards_budgetfails at!room_for(Some((budget, budget)), ..)(card at its budget); the other test passescargo clippy -p leonida-gpu -p leonida-hle --all-targetsThe budget the guard reads, on the card and on WARP
room()gets the budget fromHost::video_memory()(QueryVideoMemoryInfo, local group). Throwaway test: made 24 committed 32 MiB default-heap buffers and readvideo_memory()before and after each.LEONIDA_D3D12_WARP=1,diagnostics)CurrentUsagegrew by what was madevideo_memory()costSo on both adapters the guard's
usedreflects a copy as soon as it is made, and WARP does not hit the "budget 0" path (only its shared group reports 0, whichroom()does not use). What bounds the overshoot past the budget is therefore how oftenroom()is asked, not the sample. Indraw.rsthat is once at the start of a pass and again every 32 MiB uploaded (reading), so a pass can still add up to about 32 MiB plus one copy onceusedreaches the budget.Edge values (
room_fordirectly, budget B = 8,000 MiB, percent 90)main:filled < 0is never true)u64::MAXThe last two rows are where the limit path and the share path disagree beyond the intended "past nine tenths":
pool::texture_room()because a texture placed in a free block adds nothing to the card's use. Under the new guard, onceusedreaches the budget, no copy is made even into blocks already allocated. Passing the sameheldinto the limit branch (used.saturating_sub(held) < budget) would keep the guard on new card memory only. That is my suggestion, not measured in a run.Reading vs measured
draw.rsand the overshoot bound that follows from it, and why the pool's free room matters.Not checked: any in-game run, a budget the system changes while copies are made (the table drives
room_forwith values, the OS budget did not move here), other GPU vendors,--features diagnosticssuites other than the WARP probe.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Jishnuraj07 on 2026-12-02T17:54:02Z.
In-game gate on the RTX 5060 8 GB: all four runs PASS, none over the card's budget, but the PR's arm was slower in both of its runs.
Setup:
scripts/game-gate.ps1, 300 s in the world,-PlayArgs '-SeriesS -NoFrameGen',-More 'LEONIDA_TEXTURE_BUDGET_MB=4000'(shown in every run's settings line), default memory stops. A =main23a68aec3; B = this headf854004dbmerged onto that samemain(d8ebb8426). Both buildsdiagnostics,dlss,mimalloc, clean trees. Order A B B A, each arm with its own data folder (B's started from a copy of A's warm caches; this PR changes no shader). Same save, standing still where it loads. NVIDIA GeForce RTX 5060 8 GB, driver 621.47 (32.0.16.2147), Windows 11 Pro 26200.mainmainNo crash, device loss or missed pipeline wait in any run. *Runs 3 and 4 carry the warnings
killedandcache_not_saved: the gate found no window to sendSC_CLOSEto (noclose_sentevent) and killed the game 60 s after the stop request. The gate'sGateWindow.Closeskips a window with an empty client area, which is what a minimised window has; that is my guess at the cause, not checked. It happened on both arms, after the measured window.What this shows
mainstayed under the budget too in both of its runs (peaks 6.7–6.8 GB of 7.0–7.1 GB, 0 s over), so the case this PR guards against (#2658's 7,823 MB of 7,256 MB) did not come up here. An earlier run ofmainon this PC without the limit did go over (7,138 / 6,917 MB for 80 s, amemory_stop), so it can happen on this card, just not in these four.tools/d3d12_ab_compare.py abbaover the four: world median frame time A 43.28 ms, B 50.61 ms (run by run: A 43.74, B 49.85, B 51.36, A 42.81). Its verdict isnot enough runs(it needs 3 a side), so this is not a measured regression yet, but every B run is slower than every A run.A possible cause, not checked: with a limit set, the new guard stops copies whenever
used >= budgetat the momentroom()asks. The gate reads video memory every 5 s and saw no time over the budget, but these runs sat within ~100–300 MB of it, so short peaks between its readings could refuse copies thatmainmakes. I found no log line that counts copies made or refused, so I cannot tell from these runs. Next on this PC: two more A/B pairs (scripts/game-abba.ps1, so the comparison gives a verdict), and, if B stays slower, a count of copies refused by the budget guard.AI-assisted: yes, Claude Opus 5.5 (Claude Code) ran the gate runs and the comparison and drafted this comment.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T17:59:59Z.
Triage of head
f854004db(merge base69cd4106c, 38 commits behind;git merge-treeagainst currentmain45dc41f95: no conflicts).1 file:
d3d12/crates/leonida-gpu/src/resource.rs(+89/-14).CI is at
action_requiredon this head (fork workflow approval).Existing verification: @fiestorra ran
scripts/red_green.py 3153on this head: red does not compile (the tests call the newroom_for), and the one green failure isdescriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, which fails onmainon that machine's integrated Radeon too (#2995), not from this change. The author then put the manual red step in the body (make the limit branch ofroom_forreturnfilled < limit, anda_texture_limit_stops_at_the_cards_budgetfails at the at-budget assert).This check: Read the diff:
room()is split into a pureroom_for()so the decision is unit-testable, and withLEONIDA_TEXTURE_BUDGET_MBset it now also requiresused < budget(a budget of 0 is treated as none). Root cause, not a workaround: before, the limit short-circuited the card check entirely. One nit: on the limit path the budget check uses rawused, while the share path subtracts the texture pool's free room (held); with a large pool the limit path will stop a little earlier than the share path would. Probably intended (it is the hard ceiling), but worth a sentence in the doc comment.I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.
Verdict: ready (root-cause fix with pure-function tests; red shown by edit; green failure is a known machine issue (#2995)).
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:09:15Z.
RE-VERIFIED-3153 at
f854004db—red then green, and my first control was wrongYour new head (the one after my correction at 15:49) passes:
And the moved red step is the right one now: with
room_for's limit branch put back to the oldfilled < limit(no budget clause), it fails on the line you added:The fix reads right: "A limit stands in for the floor and the share of the budget … but not for the budget itself: while the card is at or over it, no copy is added." That is the one sentence the change needed, and it is in the doc comment.
One thing about my own method, since you may run the same check: my first control neutralised the limit at the call site and all 33 tests still passed — because the tests call
room_for(…)directly, so patching the caller changed nothing they exercise. A control that does not bite is not a control, and I moved it into the function before recording a verdict.Thanks for moving the red step where it belongs instead of arguing with it.
Written with an AI assistant.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.