GPU: textures viewed only from a smaller level are uploaded from it on #2149

Open
github-bot wants to merge 2 commits from github-bot/gh-2149 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 06:14 UTC · original
0xkn0wh3r3:gpu/placed-textures-read-levels → main · +449 −33 · 8 files · 2 commits · open

Problem

A streamed texture's small mip levels can be all the title keeps of it: on fxceless/victory-fork, Grand Theft Auto VI kept only a texture's small levels and placed the next texture where the larger ones would be. GFX10 stores levels smallest first, so that neighbour lies inside the texture's layout. Today its staging reads, uploads and watches the whole layout: the neighbour's bytes end up in its large levels, and every write to the neighbour re-uploads the whole texture.

Fix

  • The first level a shader view can read (its most detailed level, or its minimum LOD clamp if later) is noted on the host texture when the view's host descriptor is made, and again when a draw or dispatch reads the texture through that view (readable in draw.rs passes it to texture::upload).
  • A single 2D texture only ever viewed from level k on is read, uploaded and watched from level k on: the start of its memory that holds those levels. Earlier levels are never uploaded.
  • A copy or read-back from the texture (copy_resource, copy_texture_region, read_back pass level 0), or a view of an earlier level, makes it whole again (a staging made from a later level is rebuilt). Arrays and other dimensions are unchanged.
  • A list that reads the texture from a later level and then, in the same list, from an earlier one queues the staging rebuilt from the earlier level too; a submission holding several stagings of one texture uploads only the one from the earliest level.
  • Watching is by 64 KiB pages, so a neighbour's write in the page the levels share still re-uploads them (only them).
  • With --features diagnostics, each staging logs its first level, the bytes read against the whole layout, and how many placed textures start in the unread levels. The first trimmed texture is logged in every build. This is what a run with the game would use to confirm the title's views start above level 0.

Not included: saving the VRAM of the unread levels (host textures are still full size), and releasing placed textures.

Testing

  • New (no game data): the readable levels of a 2048x2048, 12-level layout are a prefix of its memory; views report their first level per dimension; a placed texture in watched title memory viewed from level 3 is staged from level 3, ignores a write past its levels' watch page, re-uploads on a write inside them, and is made whole by a view of level 0.
  • draw::tests::a_shader_view_from_a_later_level_uploads_from_it: through readable with a View::Shader of level 3 on (no host descriptor made), a 256x256, 9-level texture is staged from level 3 and its upload copies 6 subresources; with a view of level 0 on it is staged and copied whole (9). With level 0 passed on that path instead, the test fails.
  • draw::tests::a_list_reading_an_earlier_level_later_uploads_it_whole: one list reads the 9-level texture from level 3, then from level 0; its submission uploads the staging from level 0 once and copies all 9 levels. Without the fix the list submitted only the level-3 staging (the test fails: nothing staged from level 0).
  • cargo test -p victory-gpu --lib on an RTX 5070 Ti: all pass except the two tests that already fail on main from the NVIDIA heap cap (#1835).
  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.
  • Not run with a game (no game data here).

Rebased onto 13f91ca

  • Upstream now takes staging buffers from a small pool shared by all textures (fdf34ab), not one per texture, and upload_changed is gone. The trimming applies on top of that: Staging gains first and prefix, and a staging reads, detiles and watches only those bytes.
  • The levels before k are never uploaded; before the rebase they were left zero. A trimmed texture whose memory is hashed (not watched) is detiled from a layout-sized scratch copy of its read bytes, and only its read levels are detiled.

Triage fix (c41f3d4)

texture::upload takes the first level the use reads. readable passes the view's first_level; the copy and read-back callers pass 0. Before, upload always noted level 0, so a texture read through a view on the readable path was uploaded whole. Rebased onto 63bcca4.

Review fix (d320b87)

fuzeofficlal found that a list which read a texture from level 3 and later from level 0 still submitted only the level-3 staging: upload returned at first_use after note_reads had dropped it. The list now notes the earliest level it asked each texture for (HostList::first_use_from) and queues the rebuilt staging when a use reads from an earlier level. Textures queued this way are uploaded by the submission's upload list, which runs before all of the submission's lists, so the order is unchanged. bindless::uploads keeps one staging per host texture, the one from the earliest level. A staging of uncommitted memory now hashes the zeros of its read prefix, like the committed path.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 06:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149) `0xkn0wh3r3:gpu/placed-textures-read-levels` → `main` · +449 −33 · 8 files · 2 commits · open ### Problem A streamed texture's small mip levels can be all the title keeps of it: on fxceless/victory-fork, Grand Theft Auto VI kept only a texture's small levels and placed the next texture where the larger ones would be. GFX10 stores levels smallest first, so that neighbour lies inside the texture's layout. Today its staging reads, uploads and watches the whole layout: the neighbour's bytes end up in its large levels, and every write to the neighbour re-uploads the whole texture. ### Fix - The first level a shader view can read (its most detailed level, or its minimum LOD clamp if later) is noted on the host texture when the view's host descriptor is made, and again when a draw or dispatch reads the texture through that view (`readable` in `draw.rs` passes it to `texture::upload`). - A single 2D texture only ever viewed from level k on is read, uploaded and watched from level k on: the start of its memory that holds those levels. Earlier levels are never uploaded. - A copy or read-back from the texture (`copy_resource`, `copy_texture_region`, `read_back` pass level 0), or a view of an earlier level, makes it whole again (a staging made from a later level is rebuilt). Arrays and other dimensions are unchanged. - A list that reads the texture from a later level and then, in the same list, from an earlier one queues the staging rebuilt from the earlier level too; a submission holding several stagings of one texture uploads only the one from the earliest level. - Watching is by 64 KiB pages, so a neighbour's write in the page the levels share still re-uploads them (only them). - With `--features diagnostics`, each staging logs its first level, the bytes read against the whole layout, and how many placed textures start in the unread levels. The first trimmed texture is logged in every build. This is what a run with the game would use to confirm the title's views start above level 0. Not included: saving the VRAM of the unread levels (host textures are still full size), and releasing placed textures. ### Testing - New (no game data): the readable levels of a 2048x2048, 12-level layout are a prefix of its memory; views report their first level per dimension; a placed texture in watched title memory viewed from level 3 is staged from level 3, ignores a write past its levels' watch page, re-uploads on a write inside them, and is made whole by a view of level 0. - `draw::tests::a_shader_view_from_a_later_level_uploads_from_it`: through `readable` with a `View::Shader` of level 3 on (no host descriptor made), a 256x256, 9-level texture is staged from level 3 and its upload copies 6 subresources; with a view of level 0 on it is staged and copied whole (9). With level 0 passed on that path instead, the test fails. - `draw::tests::a_list_reading_an_earlier_level_later_uploads_it_whole`: one list reads the 9-level texture from level 3, then from level 0; its submission uploads the staging from level 0 once and copies all 9 levels. Without the fix the list submitted only the level-3 staging (the test fails: nothing staged from level 0). - `cargo test -p victory-gpu --lib` on an RTX 5070 Ti: all pass except the two tests that already fail on `main` from the NVIDIA heap cap (#1835). - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. - Not run with a game (no game data here). ### Rebased onto 13f91ca - Upstream now takes staging buffers from a small pool shared by all textures (fdf34ab), not one per texture, and `upload_changed` is gone. The trimming applies on top of that: `Staging` gains `first` and `prefix`, and a staging reads, detiles and watches only those bytes. - The levels before k are never uploaded; before the rebase they were left zero. A trimmed texture whose memory is hashed (not watched) is detiled from a layout-sized scratch copy of its read bytes, and only its read levels are detiled. ### Triage fix (c41f3d4) `texture::upload` takes the first level the use reads. `readable` passes the view's `first_level`; the copy and read-back callers pass 0. Before, `upload` always noted level 0, so a texture read through a view on the `readable` path was uploaded whole. Rebased onto 63bcca4. ### Review fix (d320b87) fuzeofficlal found that a list which read a texture from level 3 and later from level 0 still submitted only the level-3 staging: `upload` returned at `first_use` after `note_reads` had dropped it. The list now notes the earliest level it asked each texture for (`HostList::first_use_from`) and queues the rebuilt staging when a use reads from an earlier level. Textures queued this way are uploaded by the submission's upload list, which runs before all of the submission's lists, so the order is unchanged. `bindless::uploads` keeps one staging per host texture, the one from the earliest level. A staging of uncommitted memory now hashes the zeros of its read prefix, like the committed path.
A streamed texture's small levels can be all the title keeps of it: on
fxceless/victory-fork, Grand Theft Auto VI kept only a texture's small
levels and placed the next texture where its larger ones would be. A
GFX10 texture stores its levels smallest first (the mip tail, then each
larger level), so that neighbour lies inside the texture's layout past
its small levels. Its staging read, detiled, uploaded and watched the
whole layout: the neighbour's bytes went into its large levels, and
every write to the neighbour uploaded the texture again, all of it.

Views now say which levels are read: the first level a shader view of a
texture can read (its most detailed level, or its minimum level-of-detail
clamp where that is later) is noted on the host texture when the view's
host descriptor is made, and again when a draw or dispatch reads the
texture through the view (`readable` passes it to `texture::upload`). A
single 2D texture that is only ever viewed from level k on is uploaded
from level k on: its staging reads, detiles, copies and watches only the
start of its memory that holds those levels, and the levels before k are
never uploaded. A copy or read-back from the texture, or a view of an
earlier level, reads it whole again (a staging made from a later level
is made again). Arrays and other dimensions are uploaded whole, as
before. Watching is by 64 KiB pages, so a neighbour's write in the page
the levels share with it still uploads them (only them).

With the diagnostics feature, each staging logs its first level, the
bytes read against the whole layout, and how many placed textures start
in the levels not read; the first texture uploaded from a later level is
logged in every build.

Tests (no game data):
- `the_readable_levels_are_a_prefix_of_the_memory`: on a 2048x2048,
  12-level layout, the levels from any level on are a prefix of the
  memory, and the earlier ones lie past it.
- `views_name_their_first_level`: most detailed level and clamp per view
  dimension; arrays stay whole.
- `a_texture_viewed_from_a_later_level_is_staged_from_it_only`: a texture
  placed in watched title memory and viewed from level 3 is staged from
  level 3; a write past its levels' last watch page does not upload it
  again, a write inside them does, and a view of level 0 makes it whole.
- `a_shader_view_from_a_later_level_uploads_from_it`: a texture read
  through `readable` with a shader view of level 3 on is staged from level
  3 and its upload copies 6 of its 9 levels; through a view of level 0 on
  it is staged and copied whole.
A list that read a texture through a view of a later level queued the
staging made from that level. A later use in the same list from an
earlier level made the staging again from that level, but the list had
already asked for the texture once and queued nothing more: its
submission uploaded the old staging, without the earlier levels.

The list now notes the earliest level it asked each texture for, and
queues the texture's staging again when a use reads from an earlier
one. When a submission's lists hold several stagings of one host
texture, only the one from the earliest level is brought up.

A staging of uncommitted memory hashes the zeros of the bytes it reads,
as it hashes committed memory.

Test: `a_list_reading_an_earlier_level_later_uploads_it_whole`: one list
reads a 9-level texture from level 3, then from level 0; its submission
uploads the staging from level 0 once, all 9 levels.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:12 +00:00
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 07:21 UTC · original

On partial views: first_level takes max(MostDetailedMip, floor(ResourceMinLODClamp)), reading the clamp from each dimension's own field (2D w[7], 2D array w[9], 1D/3D/cube w[6], 1D array/cube array w[8]). The floor is deliberate: a clamp of 1.5 still blends levels 1 and 2. MipLevels is ignored, because trimming the small end saves nothing worth having.

The upload follows the lowest level anything has asked for (read_from, a fetch_min). A later view from a lower level drops the held staging, and the next upload starts from that level. Copies and bound tables count as reading from level 0. Buffers and views with no description also count as level 0.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149#issuecomment-7155768701) On partial views: `first_level` takes `max(MostDetailedMip, floor(ResourceMinLODClamp))`, reading the clamp from each dimension's own field (2D `w[7]`, 2D array `w[9]`, 1D/3D/cube `w[6]`, 1D array/cube array `w[8]`). The floor is deliberate: a clamp of 1.5 still blends levels 1 and 2. `MipLevels` is ignored, because trimming the small end saves nothing worth having. The upload follows the lowest level anything has asked for (`read_from`, a `fetch_min`). A later view from a lower level drops the held staging, and the next upload starts from that level. Copies and bound tables count as reading from level 0. Buffers and views with no description also count as level 0.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 11:24 UTC · original · edited 2026-11-26 01:21 UTC

Automated triage for the maintainers.

Merge candidate. Two commits on current main, merges cleanly.

The same-list gap fuzeofficlal reported is closed in d320b87, as your reply describes. HostList::first_use_from (host.rs) keeps the earliest level a list asked for each texture and returns true again for an earlier one, so texture::upload queues the staging rebuilt from that level; bindless::uploads now keeps one staging per host copy, the one with the lowest first, so the stale level-3 staging is not uploaded beside it. Deferred texture steps are recorded into the submission's upload list, which runs before the submission's lists, so the order holds. The uncommitted path now hashes zeros[..prefix] like the committed one. The new a_list_reading_an_earlier_level_later_uploads_it_whole test covers the case.

Still open, as before: no title run here showing a texture placed in another's unread levels; the texture staged diagnostics event is the way to show it.

CI: passing (check). Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 11:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149#issuecomment-7161001744) · edited 2026-11-26 01:21 UTC <!-- victory-triage v1 head=d320b8713f067f823808f7cffa930120f10fe1a5 verdict=merge-candidate at=2026-11-26T01:21:31Z --> Automated triage for the maintainers. **Merge candidate.** Two commits on current `main`, merges cleanly. The same-list gap fuzeofficlal reported is closed in d320b87, as your reply describes. `HostList::first_use_from` (`host.rs`) keeps the earliest level a list asked for each texture and returns true again for an earlier one, so `texture::upload` queues the staging rebuilt from that level; `bindless::uploads` now keeps one staging per host copy, the one with the lowest `first`, so the stale level-3 staging is not uploaded beside it. Deferred texture steps are recorded into the submission's upload list, which runs before the submission's lists, so the order holds. The uncommitted path now hashes `zeros[..prefix]` like the committed one. The new `a_list_reading_an_earlier_level_later_uploads_it_whole` test covers the case. Still open, as before: no title run here showing a texture placed in another's unread levels; the `texture staged` diagnostics event is the way to show it. CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:06 UTC · original

Thanks. Rebased onto 63bcca4 and fixed in c41f3d4 (still one commit).

readable falling back to whole uploads. You were right: texture::upload noted level 0 for every caller, readable included. It now takes the first level the use reads (texture.rs:355, noted at :357):

  • readable passes the view's first_level(desc) for View::Shader reads, placed views included once placed_texture has turned them into View::Shader (draw.rs:1925).
  • copy_resource, copy_texture_region and read_back pass 0 (list.rs:656, :751, :860). resolve doesn't call upload.

The PR text and commit message no longer say bound tables read the texture whole.

New test draw::tests::a_shader_view_from_a_later_level_uploads_from_it (draw.rs:2939). It goes through readable with a View::Shader only and never makes a host descriptor, so make doesn't note anything. A 256x256, 9-level texture viewed from level 3 is staged from level 3, reads less than 1/16 of its layout, and its upload copies 6 subresources. Viewed from level 0, it is staged and copied whole (9). I checked that the test fails ("staged from the view's level", left 0, right 3) when that path passes 0 instead.

Results on this machine (NVIDIA):

  • cargo test -p victory-gpu --lib: 233 passed. The 2 failures are the known heap-cap ones that also fail on main (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views).
  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.
  • cargo xtask policy: ok.

A log or trace from this repo showing a placed texture inside another texture's unread levels. I can't produce that here: it needs a run with the title, and I have no game data. With --features diagnostics, each staging logs a texture staged debug event (texture.rs:956) with first, read, whole and neighbours. neighbours is resource::placed_textures_in (resource.rs:2034): the number of placed textures that start between the end of the levels read and the end of the layout. A tester running the title can show the case with an event where first > 0 and neighbours > 0. In every build, the first texture uploaded from a later level also logs "textures only viewed from a smaller level are uploaded from it on" once (texture.rs:942).

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149#issuecomment-7178405271) Thanks. Rebased onto 63bcca4 and fixed in c41f3d4 (still one commit). **`readable` falling back to whole uploads.** You were right: `texture::upload` noted level 0 for every caller, `readable` included. It now takes the first level the use reads (`texture.rs:355`, noted at `:357`): - `readable` passes the view's `first_level(desc)` for `View::Shader` reads, placed views included once `placed_texture` has turned them into `View::Shader` (`draw.rs:1925`). - `copy_resource`, `copy_texture_region` and `read_back` pass 0 (`list.rs:656`, `:751`, `:860`). `resolve` doesn't call `upload`. The PR text and commit message no longer say bound tables read the texture whole. New test `draw::tests::a_shader_view_from_a_later_level_uploads_from_it` (`draw.rs:2939`). It goes through `readable` with a `View::Shader` only and never makes a host descriptor, so `make` doesn't note anything. A 256x256, 9-level texture viewed from level 3 is staged from level 3, reads less than 1/16 of its layout, and its upload copies 6 subresources. Viewed from level 0, it is staged and copied whole (9). I checked that the test fails ("staged from the view's level", left 0, right 3) when that path passes 0 instead. Results on this machine (NVIDIA): - `cargo test -p victory-gpu --lib`: 233 passed. The 2 failures are the known heap-cap ones that also fail on `main` (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`). - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. - `cargo xtask policy`: ok. **A log or trace from this repo showing a placed texture inside another texture's unread levels.** I can't produce that here: it needs a run with the title, and I have no game data. With `--features diagnostics`, each staging logs a `texture staged` debug event (`texture.rs:956`) with `first`, `read`, `whole` and `neighbours`. `neighbours` is `resource::placed_textures_in` (`resource.rs:2034`): the number of placed textures that start between the end of the levels read and the end of the layout. A tester running the title can show the case with an event where `first > 0` and `neighbours > 0`. In every build, the first texture uploaded from a later level also logs "textures only viewed from a smaller level are uploaded from it on" once (`texture.rs:942`).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:41 UTC · original

Code review and RTX 5090 + WARP verification at head c41f3d4a4edb merged cleanly onto main (63bcca43c6a0):

  • What looks solid: HostTexture::read_from (AtomicU32), SRV MostDetailedMip/ResourceMinLODClamp extraction (first_level with NaN/negative fallback to 0), restricting partial-mip upload strictly to single-slice 2D textures (slices == 1 && Dimension::Tex2d), prefix hashing/tracking on [0, mips[first - 1].offset), and passing first = 0 on copy/readback paths in list.rs all fit together cleanly.
  • Same-list widening bug found (crates/victory-gpu/src/texture.rs:355-385):
    • upload(list, resource, texture, first) calls note_reads(&copy, first) first — if first is smaller than the previous read_from, note_reads lowers read_from and clears copy.staging = None — and then immediately checks if !list.first_use(texture.as_raw() as usize) { return; } (host.rs:2271).
    • Because list.defer_texture(staging, copy) already queued the earlier Arc<Staging> (e.g. staging.first = 3) in list.deferred().copies, and submission (host.rs:1198) consumes that captured Step::Texture(staging, copy) directly, a single HostList where Draw 1 samples with first = 3 and a later Draw 2 (or copy_resource/copy_texture_region/read_back) reads the same texture with first = 0 will update read_from/copy.staging for future lists, but return early at first_use and still submit the stale first = 3 staging on the current list — leaving mips 0..2 un-uploaded for that list.
    • Replacing/upgrading the queued Step::Texture entry when first < queued.first (or resolving the latest copy.staging at submit time) would close this intra-list gap.
  • Minor note: In the unwatched uncommitted path (texture.rs:677-680), last.hash hashes the full zeroed layout size while the committed path (texture.rs:685) hashes prefix, which causes one harmless extra detile if the memory first becomes committed while all-zero.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • texture::tests draw::tests list::tests resource::tests: 48/48 passed on RTX 5090 (default and --features diagnostics) and 48/48 passed on WARP (--features diagnostics), including all 4 new partial-mip tests.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149#issuecomment-7179016645) Code review and RTX 5090 + WARP verification at head `c41f3d4a4edb` merged cleanly onto `main` (`63bcca43c6a0`): - **What looks solid**: `HostTexture::read_from` (`AtomicU32`), SRV `MostDetailedMip`/`ResourceMinLODClamp` extraction (`first_level` with NaN/negative fallback to 0), restricting partial-mip upload strictly to single-slice 2D textures (`slices == 1 && Dimension::Tex2d`), prefix hashing/tracking on `[0, mips[first - 1].offset)`, and passing `first = 0` on copy/readback paths in `list.rs` all fit together cleanly. - **Same-list widening bug found (`crates/victory-gpu/src/texture.rs:355-385`)**: - `upload(list, resource, texture, first)` calls `note_reads(&copy, first)` first — if `first` is smaller than the previous `read_from`, `note_reads` lowers `read_from` and clears `copy.staging = None` — and then immediately checks `if !list.first_use(texture.as_raw() as usize) { return; }` (`host.rs:2271`). - Because `list.defer_texture(staging, copy)` already queued the earlier `Arc<Staging>` (e.g. `staging.first = 3`) in `list.deferred().copies`, and submission (`host.rs:1198`) consumes that captured `Step::Texture(staging, copy)` directly, a **single `HostList`** where Draw 1 samples with `first = 3` and a later Draw 2 (or `copy_resource`/`copy_texture_region`/`read_back`) reads the same texture with `first = 0` will update `read_from`/`copy.staging` for *future* lists, but return early at `first_use` and still submit the stale `first = 3` staging on the current list — leaving mips `0..2` un-uploaded for that list. - Replacing/upgrading the queued `Step::Texture` entry when `first < queued.first` (or resolving the latest `copy.staging` at submit time) would close this intra-list gap. - **Minor note**: In the unwatched uncommitted path (`texture.rs:677-680`), `last.hash` hashes the full zeroed layout size while the committed path (`texture.rs:685`) hashes `prefix`, which causes one harmless extra `detile` if the memory first becomes committed while all-zero. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - `texture::tests draw::tests list::tests resource::tests`: **48/48 passed** on RTX 5090 (default and `--features diagnostics`) and **48/48 passed** on WARP (`--features diagnostics`), including all 4 new partial-mip tests.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 01:12 UTC · original

Thanks, both points were right. Fixed in d320b87, a separate commit on top of c41f3d4.

Same-list widening. You're right. Once note_reads had dropped the level-3 staging, upload returned at first_use, so the list submitted the stale Step::Texture and levels 0..2 were missing for that list. Now:

  • HostList::first_use_from(key, first) (host.rs:2277) notes the earliest level the list has asked for each texture. It returns true again when a use reads from an earlier level. upload calls it with the use's level (texture.rs:378), so the list also queues the staging rebuilt from that level.
  • Order: deferred Step::Texture entries are not run in the list's step order. At submission they are all collected (host.rs:1199) and recorded into the submission's upload list, and that list runs before all of the submission's lists (host.rs:1214). So a step queued later in the list still uploads before any of the list's commands.
  • bindless::uploads keeps one staging per host texture, the one from the earliest level (bindless.rs:225). The stale level-3 staging is not uploaded alongside it.

New test draw::tests::a_list_reading_an_earlier_level_later_uploads_it_whole (draw.rs:2969). One list reads a 256x256, 9-level texture through readable from level 3, then from level 0. After submission the texture is staged from level 0 and uploaded once, with all 9 subresources copied. Before the fix it fails: nothing is staged from level 0 (staged_from is None), because the dropped staging was never rebuilt for that list.

Uncommitted-path hash. Fixed: it now hashes zeros[..prefix] (texture.rs:682), the same bytes the committed path hashes.

Results on this machine (NVIDIA):

  • cargo test -p victory-gpu --lib: 233 passed in each of two full runs, 3 failed in each. Two of them also fail on main here (heap cap): dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views. The third differed between runs. One run failed watch::tests::armed_ranges_keep_their_pages_bytes_from_before_the_first_write, which passed in the other full run and 3/3 times alone. The other failed views_bound_while_another_slot_gets_its_texture_do_not_wait, which is a known flaky test.
  • The texture and new draw tests also pass with --features diagnostics.
  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.
  • cargo xtask policy: ok.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 01:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2149#issuecomment-7179536979) Thanks, both points were right. Fixed in d320b87, a separate commit on top of c41f3d4. **Same-list widening.** You're right. Once `note_reads` had dropped the level-3 staging, `upload` returned at `first_use`, so the list submitted the stale `Step::Texture` and levels 0..2 were missing for that list. Now: - `HostList::first_use_from(key, first)` (`host.rs:2277`) notes the earliest level the list has asked for each texture. It returns true again when a use reads from an earlier level. `upload` calls it with the use's level (`texture.rs:378`), so the list also queues the staging rebuilt from that level. - Order: deferred `Step::Texture` entries are not run in the list's step order. At submission they are all collected (`host.rs:1199`) and recorded into the submission's upload list, and that list runs before all of the submission's lists (`host.rs:1214`). So a step queued later in the list still uploads before any of the list's commands. - `bindless::uploads` keeps one staging per host texture, the one from the earliest level (`bindless.rs:225`). The stale level-3 staging is not uploaded alongside it. New test `draw::tests::a_list_reading_an_earlier_level_later_uploads_it_whole` (`draw.rs:2969`). One list reads a 256x256, 9-level texture through `readable` from level 3, then from level 0. After submission the texture is staged from level 0 and uploaded once, with all 9 subresources copied. Before the fix it fails: nothing is staged from level 0 (`staged_from` is `None`), because the dropped staging was never rebuilt for that list. **Uncommitted-path hash.** Fixed: it now hashes `zeros[..prefix]` (`texture.rs:682`), the same bytes the committed path hashes. Results on this machine (NVIDIA): - `cargo test -p victory-gpu --lib`: 233 passed in each of two full runs, 3 failed in each. Two of them also fail on `main` here (heap cap): `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`. The third differed between runs. One run failed `watch::tests::armed_ranges_keep_their_pages_bytes_from_before_the_first_write`, which passed in the other full run and 3/3 times alone. The other failed `views_bound_while_another_slot_gets_its_texture_do_not_wait`, which is a known flaky test. - The texture and new draw tests also pass with `--features diagnostics`. - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. - `cargo xtask policy`: ok.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2149/head:github-bot/gh-2149'
git switch 'github-bot/gh-2149'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2149'
git switch 'github-bot/gh-2149'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2149'
git switch 'github-bot/gh-2149'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2149'
git switch 'main'
git merge --squash 'github-bot/gh-2149'
git switch 'main'
git merge --ff-only 'github-bot/gh-2149'
git switch 'main'
git merge 'github-bot/gh-2149'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/Marvisak--VIctory!2149
No description provided.