perf(vk): the texture pipelines made before the game, through the pipeline cache #1701
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!1701
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/texture-pipelines-before-game"
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: perf · Risk: low · Tested on: CachyOS Linux, RTX 3090 · Needs: Windows, AMD and Intel (a first start's first ASTC texture)
TL;DR
On a first start, or after a new build or driver update empties the driver's shader cache, the first ASTC or BC texture the game showed held one frame for about a third of a second: the texture converters' GPU programs were compiled right then, with no cache. This PR builds them during the loading screen through the game's pipeline cache. On an RTX 3090 that 316 ms frame is gone. The loading screen pays 425 ms once, then 1 ms on later starts.
Breakdown
Why
Most players use DLSS or FSR, and every update means a new renderer whose pipelines the driver has not seen. The texture converters (the ASTC decoder, the BC3/BC7 encoders, the GPU unswizzle) were the last compute pipelines made in play: in a profile of a first start on an RTX 3090, the ASTC decoder took 274 ms of a 283 ms frame and the BC encoder about 130 ms of a 494 ms frame.
What changed
The three converters' pipelines go through the same cached path as the game's own compute pipelines, and are built at the start of the pipeline preparation, before the title.
texture_compute_pipeline()ingpu/vk/vk_texture.cppmakes a converter's pipeline throughshared_compute_pipeline(the pipeline cache) and falls back to the uncached path as before.astc_ready(),bc_ready()andunswizzle_ready()holdIntelDriverGatefor their shader modules only, sinceshared_compute_pipelinetakes it too.texture_pipelines_warm()calls the three and logs the time.precompile_run()ingpu/vk/vk_draw.cppopens the pipeline cache and callstexture_pipelines_warm()first.Measurements
Verdict: The first start's 316.5 ms frame on the first ASTC texture is gone. The pipelines take 425 ms during the loading screen on a first start and 1 ms after. Play's frame rate doesn't change (the Market numbers below are the same build as #1702, where they are reported).
Hardware: CachyOS Linux (kernel 7.3.3), RTX 3090 24 GB, NVIDIA 620.70.06, Ryzen 9 7900X, 32 GB
Scene: a new start from the title to Castle Town Market (debug teleport), then 5 s walking and 20 s turning; 2560x1440 output, DLSS Quality, no frame generation,
HOS_FPS_MAX=1000; a private headless swayMethod: each side's first start with an empty NVIDIA shader cache of its own (
__GL_SHADER_DISK_CACHE_PATH), then two more starts with it warm; the log'sslow uploadandslow submitlines (frames over 15 ms).How to reproduce: empty the driver's shader cache, start the game, go to the Market;
grep "slow upload" longshot_log.txt.Baseline: both columns are renderers built alone on a base at main
da91e770, measured before the rebase onto09cbdd97. The renderer this PR changes is unchanged by the rebase (jjrebased it cleanly; the main commits in between don't touch the converters orprecompile_run). The After column's renderer also had #1121 and #1702's commits, which don't touch the texture path.da91e770da91e770)Flags and settings
None.
Testing
Tested: CachyOS Linux, RTX 3090, NVIDIA 620.70.06: the renderer built alone on a base of main, three starts (one with an empty driver cache) to Castle Town Market, walking and turning; no
slow uploadline over 15 ms, no device loss or failed pipeline. The rebased head compiles (scripts/dev_build.py vk).Not tested: Windows; AMD (RADV, Adrenalin); Intel, where
IntelDriverGatenow covers only the modules.mise run test: not run on this PC (the team's checks run it on the forge).Must be tested:
texture pipelines made before the game in <n> ms (ASTC decoder yes, ...)in the log and noslow uploadof an ASTC texture over 50 ms (Test Farm: @Beanstalk)Risks
What could break: a converter's pipeline failing to build through the cache. It then falls back to the old path, and the log's line says
nofor it. On Intel,IntelDriverGatenow covers the module and the uncached fallback but not the cached build, which takes it itself.Turning it off: revert the commit.
Compatibility: The pipeline cache gains three pipelines; nothing else changes.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks. (A first start's loading screen is 425 ms longer.)
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). Not run on this PC.third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md). (tests/test_tested_configurations.pynot run on this PC.)🤖 Generated with Claude Code
https://claude.ai/code/session_016o1k1PazAdTJxQQWQBksW2
Tested in game: RTX 3090, NVIDIA 620.70.06, CachyOS Linux (headless sway): three starts to Castle Town Market at 2560x1440 with DLSS Quality, one with an empty driver cache: the texture pipelines were made before the game (425 ms, then 1 ms), no slow upload of an ASTC texture in play (main: 316.5 ms on the first start), no device loss
Description: links #1702, the presenter-thread PR whose Market numbers were measured on the same build.
@HumanBean
/beanstalk
Beanstalk test farm
Commit
d60f91b· tier reviewed · approved by HumanBean · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)The plan compares startup and Market gameplay on main and the PR, including texture appearance, shader preparation, load time and frame pacing. It takes about 20 minutes per tester and fails on crashes, converter failure logs, large ASTC upload stalls, visible differences or specified performance regressions. Driver caches are not cleared by the plan, so it cannot guarantee a cold-cache first-start test.
kokiri-start, then teleport to Market, take the picture market to compare with main, move the stick, measure market for 20 s (after 5 s warm-up); 2 runs on each side.Done (started 05:01 UTC, last report 05:13 UTC). Comment
@Beanstalkto run it again.NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0; 2: linux+amd+radv+dgpuAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7Measurements · any
Verdict: could not be judged on any (2/1 report).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAMScene: market-textures, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-textures: 2 game starts a side, market 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)09cbdd9d60f91bFlags and settings
None: the plan varied no setting, switch or build option.
Markdown for the PR description
WIP: perf(vk): the texture pipelines made before the game, through the pipeline cacheto perf(vk): the texture pipelines made before the game, through the pipeline cachemooki referenced this pull request2026-11-19 07:36:54 +00:00
mooki referenced this pull request2026-11-19 08:23:56 +00:00