feat(vk): RX_VK_TEST_VRAM_MB takes the card's VRAM as at most n MiB wherever the renderer sizes something by it #1107
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1107
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:feat/test-vram-mb"
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?
Type: feat · Risk: low · Tested on: Linux, RTX 3090 · Needs: a Windows build (llvm-mingw)
Why
The renderer sizes several things by how much video memory the card has, not only by what the driver allows: how many texture blocks it makes at the start, the mirrors' budget, the texture budget's rule and the auto settings.
RX_VK_TEST_ALLOWED_MBlowers the allowance alone, so on a large card those parts still follow its real heap. A 6 GB card's rules can't be played on a 24 GB card, and the open small-card PRs gated on the card's size (#1057, #1073, #637) can't be measured on one.RX_VK_TEST_VRAM_MB=<MiB>takes the card's VRAM as at most that much in every place that reads it. With both switches a large card runs a small one's whole policy:RX_VK_TEST_VRAM_MB=6144 RX_VK_TEST_ALLOWED_MB=5233is the RTX 3050 6 GB Laptop of #637, #1057 and #1073.What changed
One helper caps the card's VRAM at
RX_VK_TEST_VRAM_MBfor every place that sizes something by it. Unset, it returns the heap as it is, so nothing changes for players.test_vram_bytes(heap)ingpu/vk/vk_memory.cpp(declared invk_internal.h) returns the heap capped atRX_VK_TEST_VRAM_MB, or the heap when it's unset.device_vram_bytes()returns it, so the mirrors' budget (mirror_budget) and the texture budget's rule (texture_rule::dedicated_bytes) follow.blocks_at_start()ingpu/vk/vk_vma.cppreads the heap through it.auto_profile()ingpu/vk/vk_main.cppreadshw.vram_mbthrough it.tests/test_blocks_at_start.py's fixture compilesblocks_at_startcut fromvk_vma.cpp, so it gets a stand-intest_vram_bytesthat returns the heap.docs/development.md, besideRX_VK_TEST_ALLOWED_MB, whose row now points to it.Measurements
Verdict: with the switch set the renderer reads the 3090 as a 6 GB card: the texture budget comes from 6,144 MB and the texture pool starts with 7 blocks, against 24 with it unset. Nothing changes with it unset.
Hardware: Linux (CachyOS, kernel 7.3.3), RTX 3090 24 GB, NVIDIA 620.70.06, Ryzen 9 7900X, 30 GB
Scene: Hyrule Field then Castle Town Market (teleports), walking and turning; 2560x1440
Method: the startup lines of
longshot_log.txtin two sessions of one build (mainc167ec67with this change, as a dev_packs pack): one withRX_VK_TEST_VRAM_MB=6144 RX_VK_TEST_ALLOWED_MB=5233, one with neitherHow to reproduce: start the game with and without the two switches and read the lines below
Baseline: both columns are one build: this change on main
c167ec67(a dev_packs pack), rebased since onto main13e90a5e, whose commits don't touch these lines. Unset is main's behaviour, so no separate main column.7bc398f47bc398f411000 MB (driver allows 21279 MB, the card has 24576 MB, ...)3584 MB (driver allows 5233 MB, the card has 6144 MB, ...)The mirrors' budget isn't logged; it reads
device_vram_bytes(), which returns the capped size.Builds with this change (main, and main with #637, its parts and #1073) ran about 20 sessions with the switch set, measuring a 6 GB card's rules on the 3090 against each other. Like
RX_VK_TEST_ALLOWED_MB, it does not make the driver short of memory: going over the allowance costs a Linux NVIDIA card next to nothing, so it tests a small card's policy, not its paging.Flags and settings
One diagnostic switch, unset for everyone.
RX_VK_TEST_VRAM_MB=<MiB>Testing
Tested: Linux, RTX 3090, NVIDIA 620.70.06, in the game: Hyrule Field and the Market, about 20 sessions with the switch set and several with it unset (lines above). The renderer built from this change ran in a game folder built from main
c167ec67; it is rebased since onto main13e90a5e, whose commits don't touch these lines.Not tested:
python -I -B tests/run_all.py: not run on this PC (no test suites run on it); left to CI. The checks that read the changed source:tests/test_blocks_at_start.py(fixture given a stand-in),tests/test_mirror_budget.py(readsmirror_budget, unchanged),tests/test_auto_handheld.py(leaves out thehw.vram_mbline).getenv,atoi); not built for Windows here.Must be tested:
gpu/vk/vk_memory.cpp,vk_vma.cppandvk_main.cppto build with no error or warningRisks
What could break: nothing with the switch unset:
test_vram_bytesreturns the heap unchanged.Turning it off: leave
RX_VK_TEST_VRAM_MBunset.Compatibility: no cache, save or options file changes; the renderer's interface is unchanged.
Issues
See #637
See #1057
See #1073
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). Not run on this PC (no test suites run on it); left to CI.third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.tests/test_blocks_at_start.py's fixture gets a stand-in for the new call; the others are unaffected (Testing).getenvandatoi.🤖 Generated with Claude Code
Tested in game: RTX 3090, NVIDIA 620.70.06, Linux (CachyOS): Hyrule Field and Castle Town Market, about 20 sessions with RX_VK_TEST_VRAM_MB=6144 RX_VK_TEST_ALLOWED_MB=5233 and several with it unset. Set, the log reads the card as 6144 MB (texture budget 3584 MB, 7 starting blocks); unset, as 24576 MB (11000 MB, 24 blocks). No crash or device loss in any session.
Possibly related, for context:
WIP: feat(vk): RX_VK_TEST_VRAM_MB takes the card's VRAM as at most n MiB wherever the renderer sizes something by itto feat(vk): RX_VK_TEST_VRAM_MB takes the card's VRAM as at most n MiB wherever the renderer sizes something by itp0lux referenced this pull request2026-11-16 13:31:12 +00:00