XG: check the tiled source before copying a subresource #986

Open
Marukooh wants to merge 3 commits from upstream-pr/992 into main
Marukooh commented 2026-11-24 10:04:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Marukooh on 2026-11-24T10:04:13Z.


Stacked on #976 and #684. Only the top commit, 3c36945, belongs to this PR.

CopyFromSubresource now checks the backing source range before detiling a volume or array slice. An unreadable source returns E_INVALIDARG before modifying the destination. This addresses the source check noted in the review of #684.

What is in it

  • Validate the source span for each existing detiling path. Keep the existing shader-blob limit for shader callers and use the shared range check for texture backing.
  • Cover unreadable 2D and 3D backing in a synthetic regression case.

Tested

  • Windows GNU Release cross-build with Rust 1.98.0 on CachyOS. Proton Experimental, patched vkd3d-proton 3.1, Intel Core i9-14900KF, RTX 5070 Ti (620.73.04), and DXC 1.9.2609.5.

  • The new synthetic case ended the test process on the #976 base. On this head the XG group passes 7/7 and the shader group passes 4/4, with zero failures or ignores in either filter.

  • Workspace suite under Proton: 719 passed, 4 failed, and 41 ignored, with 2 GPU skip markers included in those totals. Failures were in XAudio2, the synthetic-title end-to-end test, PLS quota, and predication. The full suite is not green.

Regression run

Same retail title and 60-second limit on both builds under Proton, using the smoke helper from #257 and VKD3D_CONFIG=ignore_shared_fence,single_queue. The Windows process-commit counter reported 0 MB under Wine.

xcl-smoke v1
commit: 6bac4b4419886acc940d479dcf8815d0b1804435
gpu: NVIDIA GeForce RTX 5070 Ti
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1387 (PresentX 1387)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 3c3694501863ccd143a1e909324a9b22cb24e83d
gpu: NVIDIA GeForce RTX 5070 Ti
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1372 (PresentX 1372)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

Native Windows, a native retail smoke pair, and a long run through world loading.

AI use

OpenAI Codex (GPT-6) wrote the change and its test, ran the local checks, and prepared the description.

<!-- greyfinch-sync:ivall/xcl:issue:5470048314 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/992). Originally posted by [Marukooh](https://github.com/Marukooh) on 2026-11-24T10:04:13Z. --- Stacked on #976 and #684. Only the top commit, `3c36945`, belongs to this PR. `CopyFromSubresource` now checks the backing source range before detiling a volume or array slice. An unreadable source returns `E_INVALIDARG` before modifying the destination. This addresses the source check noted in the review of #684. **What is in it** - Validate the source span for each existing detiling path. Keep the existing shader-blob limit for shader callers and use the shared range check for texture backing. - Cover unreadable 2D and 3D backing in a synthetic regression case. **Tested** - Windows GNU Release cross-build with Rust 1.98.0 on CachyOS. Proton Experimental, patched vkd3d-proton 3.1, Intel Core i9-14900KF, RTX 5070 Ti (620.73.04), and DXC 1.9.2609.5. - The new synthetic case ended the test process on the #976 base. On this head the XG group passes 7/7 and the shader group passes 4/4, with zero failures or ignores in either filter. - Workspace suite under Proton: 719 passed, 4 failed, and 41 ignored, with 2 GPU skip markers included in those totals. Failures were in XAudio2, the synthetic-title end-to-end test, PLS quota, and predication. The full suite is not green. **Regression run** Same retail title and 60-second limit on both builds under Proton, using the smoke helper from #257 and `VKD3D_CONFIG=ignore_shared_fence,single_queue`. The Windows process-commit counter reported 0 MB under Wine. ``` xcl-smoke v1 commit: 6bac4b4419886acc940d479dcf8815d0b1804435 gpu: NVIDIA GeForce RTX 5070 Ti title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1387 (PresentX 1387) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` ``` xcl-smoke v1 commit: 3c3694501863ccd143a1e909324a9b22cb24e83d gpu: NVIDIA GeForce RTX 5070 Ti title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1372 (PresentX 1372) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` **Not tested** Native Windows, a native retail smoke pair, and a long run through world loading. **AI use** OpenAI Codex (GPT-6) wrote the change and its test, ran the local checks, and prepared the description.
dcastell1 commented 2026-11-24 11:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T10:21:57Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@02bfd1d (baseline 727 passed, 0 failed, 41 ignored on this box; the head of this PR is based on 9aec53d, which is why the base is stated):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
731 passed; 0 failed; 41 ignored   (exit 0)

Four more passing tests than the baseline; checking the tiled source before copying a subresource ships its own coverage and it runs green here.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7128677422 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/992#issuecomment-7128677422). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T10:21:57Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@02bfd1d` (baseline **727 passed, 0 failed, 41 ignored** on this box; the head of this PR is based on `9aec53d`, which is why the base is stated): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 731 passed; 0 failed; 41 ignored (exit 0) ``` Four more passing tests than the baseline; checking the tiled source before copying a subresource ships its own coverage and it runs green here. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
DavidM1911 commented 2026-11-24 13:03:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:30:53Z.


Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo test -p xcl --lib hle::xg::: 7 passed, 0 failed — includes the new copy_from_rejects_unreadable_source for the tiled-source check.
  • cargo test -p xcl --test xg_oracle: 6 passed, 0 failed, 12 ignored (sample-gated prints ignored; all runnable oracle comparisons pass).

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7131545673 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/992#issuecomment-7131545673). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T12:30:53Z. --- Independent verification, merged onto current `main` `384f7f7` locally (clean merge). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug. - `cargo test -p xcl --lib hle::xg::`: **7 passed, 0 failed** — includes the new `copy_from_rejects_unreadable_source` for the tiled-source check. - `cargo test -p xcl --test xg_oracle`: **6 passed, 0 failed, 12 ignored** (sample-gated prints ignored; all runnable oracle comparisons pass). AI use: test runs by Devin (Cognition, SWE-2); no code changes.
DavidM1911 commented 2026-11-26 04:07:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:32:03Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7181802423 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/992#issuecomment-7181802423). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T03:32:03Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
github-actions[bot] commented 2026-11-30 08:42:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:42:05Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273235009 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/992#issuecomment-7273235009). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:42:05Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:36:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:36:14Z.


Triage (#1607) – head 3c36945

Stacked on #976 and #684; only 3c36945 is this PR's own: copy_from checks that the tiled source range is readable (new shader::readable_range, readable keeps its 256 MiB limit) before it detiles. No other open PR makes that change.
The same caveat as for the base PRs applies: main (adccb7d) already reads CopyFromSubresource in both the 6- and 7-argument forms through copy_args. The stack's hardcoded 7-argument copy_from signature conflicts with that and would drop the 6-argument form, so the source check needs to be rebased onto main's copy_args version.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300903029 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/992#issuecomment-7300903029). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:36:14Z. --- **Triage (#1607)** – head 3c36945 Stacked on #976 and #684; only 3c36945 is this PR's own: `copy_from` checks that the tiled source range is readable (new `shader::readable_range`, `readable` keeps its 256 MiB limit) before it detiles. No other open PR makes that change. The same caveat as for the base PRs applies: main (adccb7d) already reads CopyFromSubresource in both the 6- and 7-argument forms through `copy_args`. The stack's hardcoded 7-argument `copy_from` signature conflicts with that and would drop the 6-argument form, so the source check needs to be rebased onto main's `copy_args` version. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/992:upstream-pr/992'
git switch 'upstream-pr/992'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/992'
git switch 'upstream-pr/992'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/992'
git switch 'upstream-pr/992'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/992'
git switch 'main'
git merge --squash 'upstream-pr/992'
git switch 'main'
git merge --ff-only 'upstream-pr/992'
git switch 'main'
git merge 'upstream-pr/992'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!986
No description provided.