How many texture re-uploads bring the same bytes the image already holds? Nothing in the renderer compares them #1608
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#1608
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?
Type: performance · Area: renderer, texture upload, memory sync · Part of: #1493
TL;DR
A texture is re-uploaded when its guest pages were marked written, whatever bytes were written. If the game, or the host for it, writes the same bytes again, the capture still copies them and the renderer still uploads them. The open pull request #1576 stops the host from marking identical copies; this issue asks what is left after it and whether a content check in the capture is worth its cost. We propose a sampled counter first, and no renderer change until it shows a number.
Breakdown
Evidence
Code on
forge/mainat430eef4f2:gpu/vk/vk_texture.cpp:2034-2063,texture_dirty: the dirty ranges of a texture come frommemory_written_runs(write generations), and for a texture in a virtual pool from a walk of the GPU mappings. No content is read.:3024: a texture that was uploaded and has no dirty range returns. Otherwise the dirty ranges go touploadat:3114.:1574-1594,upload: bytes and time per upload route are already counted (UpStat), so bytes uploaded per frame are known. None counts bytes whose content equals what the image holds.gpu/vk/vk_memory.cpp:1402-1412and:1675-1700: the capture keeps a shadow copy of each page a texture's storage covers and compares live bytes with it for another purpose (st_differed). A page equal to its copy is therefore cheap to detect at the capture, but nothing uses the answer.memcpyandmemmovefrom 4 KB up. Its description reports about 76,000 copies and 970 MB left out in a Market run, and a texture initialised with the same data up to 77 times. That removes a cause on the host side.The fork's claim, not ours: an outside audit of a fork says that after a tour the game rewrote large block-compressed textures every few frames with identical bytes, that a content check in the capture and a hash per unit of the image cut the uploads sharply, and quotes frame rate gains. Those figures come from comments in the fork's source, measured on a lab PC and partly on another port. We use none of them.
Proposed change
How we would test it
Related
New on this forge; not opened on GitHub.
Possibly related, for context: