Skip to content

GPU: refresh a texture alias after its source is written again - #2341

Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/refresh-gpu-alias-after-source-write
Open

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/refresh-gpu-alias-after-source-write

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown

A placed texture alias was copied once per command list. If the source was written again in that list, the next read through the alias could still see the first write.

Track the source host texture and its write version at the time of the alias copy. A write-capable use invalidates the relevant record. A later read can reuse the alias when it still holds that source version.

The synthetic WARP fixture records two GPU writes to an R32G32_UINT source and reads its placed BC1 alias after each write in the same list. A direct source read between the second write and alias copy confirms the write landed.

Tree Source after second write First and second alias readbacks
940d32f green 0x07e0 red 0xf800, red 0xf800
4297bb9 green 0x07e0 red 0xf800, green 0x07e0

Full forced-WARP GPU library suite passed (147 passed, 2 ignored). Strict GPU Clippy passed in both feature modes. Repository policy passed.

Coordination claim

Please preserve the Git author if you cherry-pick the change. If you fold the code or regression into another commit, please add:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted. Synthetic tests only.

Cache an alias by the source texture and its last write in the command list. A write-capable use invalidates that record even after another read changes the source state. Exercise both GPU writes and read the placed alias twice in a single WARP submission.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Refreshing a texture alias when its source is written again in the same command list cleanly prevents stale placed reads after subsequent GPU writes.
  • cargo test -p victory-gpu resource::tests: 11/11 passed on RTX 5090, 11/11 passed on WARP (including live GPU test a_second_gpu_write_reaches_the_placed_alias_in_the_same_list).
  • cargo test -p victory-gpu texture::tests: 2/2 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Author

I tested this change together with #2314 at 1735610. Git combines both branches cleanly. The direct multisampled path also needs to record the completed alias copy so another read can reuse it until the next write.

Combined branch and test 76381a5 preserves both PR heads. The WARP fixture records two depth clears. It checks that the second write invalidates the original copy, its resolve reads 0.625, and each completed copy satisfies a subsequent read. The reuse assertion failed in the plain merge and passed with the added recording call. Both alias tests passed together. The full GPU suite gave 148 passed, 2 ignored. Strict GPU Clippy in both modes and repository policy passed.

If the code or tests are folded into another commit, please add:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted. Synthetic tests only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants