fix(vk): scale actor turf quota by patch pitch area (#2955) #3025
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3025
Loading…
Reference in a new issue
No description provided.
Delete branch "cfw34683/Longshot:fix/2955-market-turf-density"
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?
Summary
Fixes #2955.
In
turf_population.comp,sim_turf_actor_blades(quota) is applied per patch, whilefootprint_binnormalizes each patch radius against that atlas's own(min_patch_radius + max_patch_radius) / 2midpoint. BecauseHyruleField_Childuses a0.250-unit patch pitch (8x8 tiles) whileMarket_Childuses a0.125-unit patch pitch (4x4 tiles),Market_Childpacks(0.25 / 0.125)^2 = 4xas many patches per unit area at the same per-patch quota, expanding the actor turf pools to ~9M records (411+ MB/pool) and causing severe GPU-bound FPS drops on the Temple of Time road.This adds
sim_turf_population::pitch_scaled_quota(density, pitch, valid_pitch)ingpu/vk/sim_turf_population.hand uses it inturf_populate(gpu/vk/vk_draw.cpp) to scale per-patchquotaby(pitch / 0.25)^2whenpitch < 0.25(keeping at least 1 blade when enabled, 0 whendensity <= 0, and leavingpitch >= 0.25/ invalid pitch unscaled).Testing
clang++/llvm-mingw, Windows 11):python -I -B tests/test_turf_budget.py --cxx clang++- PASS (includes newpitch_scaled_quotaassertions)python -I -B tests/test_sim_turf_floor.py- PASSpython -I -B tests/test_sim_turf_group_limit.py- PASSpython -I -B tests/test_sim_turf_capacity_policy.py --cxx clang++- PASSpython -I -B tests/test_sim_turf_pools.py --cxx clang++- PASSMarket_Child,market-entrancesave walking the Temple of Time road,Maxturf preset150 / 100 / 43, Windows 11, NVIDIA GeForce RTX 3070 Ti):8,978,432records (411.0 MB/pool), GPU frame time up to18.6 ms(longest submission 14.3 ms), FPS dropped to ~26-45 FPS.2,490,368records (114.0 MB/pool), GPU frame time8.3 - 12.4 ms(longest submission 4.3 - 8.3 ms), holding ~60 FPS (59.7 - 60.2 fpsin logs, brief 57 FPS dip).Checklist
main, Conventional Commit title.tests/test_*sim_turf*.py/tests/test_turf_budget.py.Assisted-by: Antigravityrecorded in commit.Possibly related, for context:
b0f470d5b361bab746e2@review
Recommendation: Approve. The new test does not cover the renderer wiring, so the original bug can return while the test still passes. The quota scaling also leaves the shader’s minimum blade count unscaled for small footprints. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change lowers actor-turf quotas for fine-pitch atlases, reducing the reported pool size and GPU workload on the Temple of Time road. It also changes visible turf density and leaves small-footprint patches at a higher world-space density than intended.
Should fix (1): not blocking, but worth doing before merging.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
tests/test_turf_budget.py:147: Is there a current failing renderer behavior caused by the missing wiring test?Checks: Failing on this head, which is behind its base, where it passes:
PR description / Title and description (pull_request_target).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 10 checks.More: does it help, other systems, switches, what was read
Does it help: Unproven. The PR reports a peak reduction from 8,978,432 to 2,490,368 records per pool and an improvement from roughly 26–45 FPS to around 60 FPS on Windows 11 with an RTX 3070 Ti. It does not identify repeated interleaved runs, frame-time distributions, or 1% lows, so the size and consistency of the gain remain unverified.
Other systems: The actor-turf path changes on every GPU and OS when the atlas pitch is below 0.25; the game’s original turf renderer is unaffected. The supplied run covers Windows and NVIDIA only, and does not establish the visual result or behavior on AMD, Linux, or Steam Deck.
Switches: None added, changed, or removed.
Reviewed:
61bab746e2againstb40214d2bb: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full diff and commit, sim_turf_population.h, test_turf_budget.py, the population shader, the turf menu, and the changed function and its caller in vk_draw.cpp. Re-read each changed diff. Skimmed related call sites and test integration; did not read all 14,748 lines of vk_draw.cpp. docs/review-checklist.md and ../Tooling/AGENTS.md are absent. No recorded runs, translations, or generated files were changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code, scripts, builds, or tests were run. CI is still running.
Overlaps and merge order: Not checked; network access is unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.