Idea: the game's 12288 x 12288 D16 shadow map takes 288 MB of VRAM on every GPU; a half-size one on cards with little VRAM #1295
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#1295
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?
The idea
The game makes one 12288 x 12288 depth image, D16 (NVN 0x32,
VK_FORMAT_D16_UNORM): 288 MB of VRAM, on every GPU, made once per area and kept while you are in it. On an 8 GB card that is about 4% of what the renderer is allowed to use (an RX 6600 in #1066 was allowed about 6,500-7,400 MB). The idea: on cards with little VRAM, draw and keep it at half the size, 6144 x 6144, 72 MB, 216 MB less, as an Auto choice by VRAM with a switch to turn it off.What it is, from two diagnostic runs on main
1764fed2(a local build only, not proposed for merging), RX 9070 XT, Linux, RADV, with the task + mesh compute fallback, child Link, Market, Kokiri Forest, Hyrule Field, Kakariko Village and Death Mountain Trail:host/oot_shadow.c). This one is fixed at 12288, a static shadow map of the area: about 90-170 draws when an area loads, then a few more while you stay, none in between.d8180bd8c6ecc77b,489438d734e2463a,531432c36205e5ce), each in one slot, as a 2D depth-compare texture: not by integer texel, not from a light table. That is what makes a smaller image possible: the same coordinates land on the same place in a 6144 image drawn with its viewport and scissor halved.The same image is in players' rc.5 logs: an RX 6600's in #1066 (
288 MB: 0x1145a7e000 12288x12288x1 x1 levels 1 NVN 0x32 rendered), and #1182, #1193, #1217, #1287, and a GTX 1660 SUPER's (6 GB) in #1278; in #1183 it could not be made (image 12288x12288x1 x1 levels 1 format 124 (NVN 0x32) not made).Score (docs/workflow.md): S2 (3), it is one part of a large frame-rate loss on 8 GB cards (#1066: 6.1-6.3 GB of about 6.5 GB used, textures over their budget,
GPU time 59.4 ms a frameat 15 fps); reach 0.3, a guess for cards with 8 GB or less (RX 6000 alone is 16% of the issues that name hardware), not yet counted withscripts/hardware_report.py; confidence 1.0 that the image is there and its size (reproduced with logs here and in players' logs), but the fps it gives back is not measured. Score 0.9. Alone it won't fix #1066: it is 216 MB of the gap.Not known yet, and checked before any pull request:
Anything else
Claimed: GrimVisage will try this: a switch for the half-size image, then Auto by VRAM. Tested on an RX 9070 XT (Linux, RADV, native and compute fallback) and an RX 6800 XT (Windows, compute fallback by default, with
RX_VK_TEST_VRAM_MB/RX_VK_TEST_ALLOWED_MBto play an 8 GB card's budget).Prior work searched (forge search, merged commits, team chat, worklist):
12288,12288x12288,shadow map,shadow atlas,D16,288 MB,VRAM short,texture budget. Nothing does this. Related, other parts of the same VRAM problem: #1158, #1159, #1104, #518 (render targets and VRAM given back), #1256 (the characters' own shadow maps, NVN 0x34, a different image), #790 (made this image's zero upload cheaper), #637 (merged, VRAM management for cards under 8 GB; it doesn't touch this image). #211 (TrashPanda, WIP) is about this same image from the other side: it keeps it through texture evictions so the shadows don't go missing, capped at an eighth of the texture budget, which leaves out the 288 MB map on small budgets. A 72 MB one would fit that cap from a budget of about 576 MB, so the two would work together; this one doesn't change #211's rule. See #1066, #933, #975.Possibly related, for context:
A correction to the issue:
integer 0in theatlas-diag: programline is eden'sis_integer, whether the texture's format is an integer one, not whether the program reads by texel. The conclusion stands for another reason: eden gives a compare sample and a texel read of the same texture separate slots (TextureDescriptors differ byis_depth,ir_opt/texture_pass.cpp), and each of the three programs had one slot bound to this image, a depth-compare one. A size query (TXQ) shares the sampling slot, so the diagnostic can't rule one out; that stays under "Not known yet" and gets checked in the programs' SPIR-V before a pull request.An update on the plan: half size is not the default for 8 GB cards any more.
The branch is up:
perf/half-size-static-shadowon GrimVisage's fork, 7e080be9 on main6d72ca93. The map can be made at 75 % or 50 % of its side, with its draws' viewport, scissor and clears scaled by as much (RX_VK_SHADOW_MAP_SIZE=100,75or50). Auto, by what the driver allows the process:Why not half everywhere: these shadows aren't only far away. The grass's and branches' shadows on the ground near Link come from this map. At 50 % they are visibly coarser and stepped (RX 9070 XT, Linux, main
1764fed2with the change, 2560x1440, the same spots at 100, 75 and 50; Death Mountain Trail shows it best). At 75 % they are close to the game's. Every size drew the shadows in the same places in the Market, Kokiri Forest, Hyrule Field, Kakariko Village and Death Mountain Trail, so nothing that reads the map is thrown off by the smaller image, and nothing copied it, uploaded into it or wrote it back in those runs (the branch logs it if anything does).Still to come before a pull request: VRAM and fps on main against the branch, here and on an RX 6800 XT (Windows, compute fallback) with an 8 GB card's allowance played.