The upscalers give up a frame whenever any texture is destroyed anywhere, though their own depth and colour were not touched #1606

Open
opened 2026-11-18 15:43:48 +00:00 by mooki · 1 comment
Member

Type: correctness · Area: renderer, upscalers and frame generation inputs, texture lifetime · Part of: #1493

TL;DR

The renderer keeps one global counter that moves whenever any texture is destroyed. Four places that carry the scene's depth or colour from the game's draws to the upscaler compare it with the value they saw and give the frame up when it differs, whether or not their own texture went. Under video memory pressure textures go in most frames, so the upscaler's pass is skipped and the game's own upscale shows. We propose a small record of destroyed textures by creation number, so each place asks about its own texture.

Breakdown

  • Who it affects: players using DLSS, FSR or the frame generation inputs, on cards that evict textures often (8 GB and under are the likely ones). The effect is a soft frame now and then, not a crash.
  • What is wrong: the counter says only that some texture went somewhere. A saved depth or colour texture is dropped on any move, including a compaction and a frame that merely deferred new textures, when nothing died.
  • What we propose: record the creation numbers of recently destroyed textures. A saved texture is still there unless its number is among those destroyed since it was saved. When more went than the record holds, it counts as gone, as it does today.
  • What does not change: frames where the depth or colour really went still fall back. The global counter stays for the handle lookups and descriptor reuse, which are a separate, measured question.
  • What we do not claim: how often it happens on a real card. The log names the reason once per change and every 600th time, so a frame count needs a counter first.
  • How we would prove it: a fixture for the record, then a count of fallback frames per minute on a small card, main against the change, after a null pair.

Evidence

Code on forge/main at 430eef4f2:

  • gpu/vk/vk_temporal.cpp:1165 (the frame generation inputs path, which returns) and :1282 (the engine path, which returns fail("the scene depth may be gone")): both compare cam.depth_gen with texture_destroy_generation(). fail (:311-317) logs "the game's upscale runs (...)" and returns false, so the game's own upscale runs.
  • gpu/vk/vk_fsr3_inputs.cpp:259, 280 and gpu/vk/vk_reactive.cpp:240, 254: the same compare for FSR's inputs ("the scene depth may be gone") and the reactive mask ("the scene's target may be gone").
  • gpu/vk/vk_temporal.cpp:470: the cached depth views are dropped whenever the counter moved.
  • Where the counter moves: destroy_later for every destroyed texture (gpu/vk/vk_texture.cpp:2127), the compaction (:4675), and texture_frame when new ASTC textures were deferred to a later frame (:4819), when no texture died at all.
  • Texture::id (gpu/vk/vk_texture.h:89) is a creation number that already exists "to tell images at one address apart". A pointer alone cannot say whether a texture of that address is the same one.
  • The counter has fifteen reads in five files: vk_draw.cpp (:3612, 4189, 5300, 8198), vk_temporal.cpp (four), vk_fsr3_inputs.cpp (three), vk_reactive.cpp (three) and one statistic in vk_replay.cpp:4945.

The fork's claim, not ours: an outside audit of a fork reports that the fork records the creation numbers of destroyed textures for this reason, and that without it an 8 GB card at 1440p showed soft frames recurring about once a second. That figure comes from a comment in the fork's source, not from a run, and we have not seen it on Longshot.

Proposed change

  1. A pure record with no Vulkan in it: it notes the creation number of each destroyed texture in a bounded list and keeps a running count. A query takes a texture's number and the count when it was saved and answers whether it went since: yes when its number is among the recent ones, yes when more went than the list holds, yes for number 0, otherwise no.
  2. destroy_later notes the texture. The compaction and the deferral keep bumping the old counter for the readers that need it.
  3. The four sites that save a depth or colour texture save its number and the count beside it, and ask the record instead of comparing the counter.
  4. Whether the handle lookups and the descriptor reuse could use the same record is not part of this change. Their stale views are the bug class of the issue 1126 comment at gpu/vk/vk_draw.cpp:8190-8196, so they need their own measurement and a check mode.

How we would test it

  • Game-free, written first, so it cannot pass on main: a fixture for the record. A texture not destroyed is there; one destroyed is gone; another one's destruction leaves it there; more destructions than the list holds make it gone; number 0 is gone; the running count does not confuse a saved value with a later one.
  • In the game: a counter of frames that took the engine's path against frames that fell back by reason, on a card with 8 GB or less, one route, DLSS on. Main against the change, after a main-against-main pair has said how far runs differ by themselves. A yes or no first: do fallbacks for this reason happen at all on main?
  • No speed or picture claim is made from the fixture. A picture claim needs a paired capture of the same route.
  • #1493, the renderer rewrite: slice a (texture identity and one retire queue) and the upscaler leaf both want per-object identity instead of one counter.
  • #978 (open): one retire-later holder for the upscalers' dead queues. It changes when images are freed, not how a saved texture is checked.
  • #1534 (open): a different leak in an optional pass; it also mentions textures that went.
  • #794 (open): descriptors kept across draws. The descriptor reuse already on main reads the same counter (gpu/vk/vk_draw.cpp:8198).
  • The issue about re-uploads that bring identical bytes and the one about torn re-uploads (to be linked), which share the idea that the cache should answer about one texture, not all.

New on this forge; not opened on GitHub.

**Type:** correctness · **Area:** renderer, upscalers and frame generation inputs, texture lifetime · **Part of:** #1493 ## TL;DR The renderer keeps one global counter that moves whenever any texture is destroyed. Four places that carry the scene's depth or colour from the game's draws to the upscaler compare it with the value they saw and give the frame up when it differs, whether or not their own texture went. Under video memory pressure textures go in most frames, so the upscaler's pass is skipped and the game's own upscale shows. We propose a small record of destroyed textures by creation number, so each place asks about its own texture. ## Breakdown - **Who it affects:** players using DLSS, FSR or the frame generation inputs, on cards that evict textures often (8 GB and under are the likely ones). The effect is a soft frame now and then, not a crash. - **What is wrong:** the counter says only that some texture went somewhere. A saved depth or colour texture is dropped on any move, including a compaction and a frame that merely deferred new textures, when nothing died. - **What we propose:** record the creation numbers of recently destroyed textures. A saved texture is still there unless its number is among those destroyed since it was saved. When more went than the record holds, it counts as gone, as it does today. - **What does not change:** frames where the depth or colour really went still fall back. The global counter stays for the handle lookups and descriptor reuse, which are a separate, measured question. - **What we do not claim:** how often it happens on a real card. The log names the reason once per change and every 600th time, so a frame count needs a counter first. - **How we would prove it:** a fixture for the record, then a count of fallback frames per minute on a small card, main against the change, after a null pair. ## Evidence Code on `forge/main` at `430eef4f2`: - `gpu/vk/vk_temporal.cpp:1165` (the frame generation inputs path, which returns) and `:1282` (the engine path, which returns `fail("the scene depth may be gone")`): both compare `cam.depth_gen` with `texture_destroy_generation()`. `fail` (`:311-317`) logs "the game's upscale runs (...)" and returns false, so the game's own upscale runs. - `gpu/vk/vk_fsr3_inputs.cpp:259, 280` and `gpu/vk/vk_reactive.cpp:240, 254`: the same compare for FSR's inputs ("the scene depth may be gone") and the reactive mask ("the scene's target may be gone"). - `gpu/vk/vk_temporal.cpp:470`: the cached depth views are dropped whenever the counter moved. - Where the counter moves: `destroy_later` for every destroyed texture (`gpu/vk/vk_texture.cpp:2127`), the compaction (`:4675`), and `texture_frame` when new ASTC textures were deferred to a later frame (`:4819`), when no texture died at all. - `Texture::id` (`gpu/vk/vk_texture.h:89`) is a creation number that already exists "to tell images at one address apart". A pointer alone cannot say whether a texture of that address is the same one. - The counter has fifteen reads in five files: `vk_draw.cpp` (`:3612, 4189, 5300, 8198`), `vk_temporal.cpp` (four), `vk_fsr3_inputs.cpp` (three), `vk_reactive.cpp` (three) and one statistic in `vk_replay.cpp:4945`. The fork's claim, not ours: an outside audit of a fork reports that the fork records the creation numbers of destroyed textures for this reason, and that without it an 8 GB card at 1440p showed soft frames recurring about once a second. That figure comes from a comment in the fork's source, not from a run, and we have not seen it on Longshot. ## Proposed change 1. A pure record with no Vulkan in it: it notes the creation number of each destroyed texture in a bounded list and keeps a running count. A query takes a texture's number and the count when it was saved and answers whether it went since: yes when its number is among the recent ones, yes when more went than the list holds, yes for number 0, otherwise no. 2. `destroy_later` notes the texture. The compaction and the deferral keep bumping the old counter for the readers that need it. 3. The four sites that save a depth or colour texture save its number and the count beside it, and ask the record instead of comparing the counter. 4. Whether the handle lookups and the descriptor reuse could use the same record is not part of this change. Their stale views are the bug class of the issue 1126 comment at `gpu/vk/vk_draw.cpp:8190-8196`, so they need their own measurement and a check mode. ## How we would test it - Game-free, written first, so it cannot pass on main: a fixture for the record. A texture not destroyed is there; one destroyed is gone; another one's destruction leaves it there; more destructions than the list holds make it gone; number 0 is gone; the running count does not confuse a saved value with a later one. - In the game: a counter of frames that took the engine's path against frames that fell back by reason, on a card with 8 GB or less, one route, DLSS on. Main against the change, after a main-against-main pair has said how far runs differ by themselves. A yes or no first: do fallbacks for this reason happen at all on main? - No speed or picture claim is made from the fixture. A picture claim needs a paired capture of the same route. ## Related - #1493, the renderer rewrite: slice a (texture identity and one retire queue) and the upscaler leaf both want per-object identity instead of one counter. - #978 (open): one retire-later holder for the upscalers' dead queues. It changes when images are freed, not how a saved texture is checked. - #1534 (open): a different leak in an optional pass; it also mentions textures that went. - #794 (open): descriptors kept across draws. The descriptor reuse already on main reads the same counter (`gpu/vk/vk_draw.cpp:8198`). - The issue about re-uploads that bring identical bytes and the one about torn re-uploads (to be linked), which share the idea that the cache should answer about one texture, not all. New on this forge; not opened on GitHub.
Collaborator

Possibly related, for context:

  • issue #1493 Renderer rewrite — Renderer rewrite; this issue is explicitly a renderer-rewrite slice
  • PR #978 WIP: refactor(vk): one retire-later holder for the upscalers' dead queues — Open refactor of the upscalers' deferred texture retirement queues; related lifetime code, but does not change texture identity checks
  • issue #1607 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 — Related texture-lifetime/capture concern in the renderer, but a different cause and symptom
Possibly related, for context: - issue #1493 Renderer rewrite — Renderer rewrite; this issue is explicitly a renderer-rewrite slice - PR #978 WIP: refactor(vk): one retire-later holder for the upscalers' dead queues — Open refactor of the upscalers' deferred texture retirement queues; related lifetime code, but does not change texture identity checks - issue #1607 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 — Related texture-lifetime/capture concern in the renderer, but a different cause and symptom
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#1606
No description provided.