A texture re-upload reads a capture that may have been taken while the game was still writing the texture, and nothing tells it from a finished one #1607
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#1607
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: correctness · Area: renderer, memory sync (capture and texture upload) · Part of: #1493
TL;DR
A texture's re-upload reads its storage from the copies the submit-time capture took. If the game's threads were still writing the texture when the capture ran, the copy holds a mix of old and new bytes, and the upload puts that on the GPU for a frame. The renderer already compares the live pages with the copy when it reads them, and counts the pages that differ, but nothing acts on it. We propose to export that count first, and if it shows up, to hold a large re-upload back for a frame when its pages were rewritten since the capture.
Breakdown
Evidence
Code on
forge/mainat430eef4f2:gpu/vk/vk_memory.cpp:1675-1700,memory_as_submitted: for pages that have a copy in the shadow it overlays the copy on the live bytes, and compares them withmemcmp(:1691), counting the pages that differ inst_differed. It logs every 2000 reads: "texture storage read as submitted (... pages from the copies, ... of them rewritten in guest memory since their submit ...)" (:1697).:1402-1412and:1468: the shadow holds each guest page as the last capture took it; a texture's storage joins the capture after its first upload (gpu/vk/vk_texture.cpp:3137,memory_note_texture_upload).gpu/vk/vk_texture.cpp:3024(no dirty range, no upload) and:3114(the upload): nothing there or in the upload readsst_differed, or any other signal that the pages changed after the capture.The fork's claim, not ours: an outside audit of a fork reports that in the fork's long tours a burst of large block-compressed uploads was followed by a frame in which nearly every pixel changed, that it traced this to part-written texture data decoding to large finite colours that bloom spread over the picture, and that holding such a re-upload back one frame removed it. Its counts come from its own lab and we have no log of ours that shows it.
Proposed change
How we would test it
Related
New on this forge; not opened on GitHub.
Possibly related, for context: