GPU tests: read back cleared constant buffer descriptors #2887

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2889 into main
andrewpozdnakov7-jpg commented 2026-11-25 23:08:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T23:08:26Z.


Coverage

#2449 tests that a null CBV description replaces the guest record. This test starts with a live CBV in a shader-visible guest heap and checks the actual GPU readback from both its mirrored host slot and a reused table slot. It clears the same CBV and expects both slots to read zero through a raw SRV.

This is the shader regression originally contributed in #1916, adapted to use the current guest heap mirroring and table paths. Production code is unchanged.

Verification

  • Same test on 120233cf912173e4411431a4b47579ef420310fe immediately before #2449: both slots still returned 0x11223344 after the clear in six WARP runs.
  • On 96e178d56be53cf164942a260f420d36b7dfb37b based on 842b0cb76f8f5fa9289bd779783c51ec24d75302: both slots returned 0x11223344 before the clear and zero afterward in all six runs.
  • Full native WARP GPU suite: 247 passed and one ignored with each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed. Synthetic data only.

Please retain the test's Git author if cherry-picked. If folded into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

Refs #1242

<!-- greyfinch-sync:Marvisak/VIctory:issue:6615613021 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T23:08:26Z. --- ## Coverage #2449 tests that a null CBV description replaces the guest record. This test starts with a live CBV in a shader-visible guest heap and checks the actual GPU readback from both its mirrored host slot and a reused table slot. It clears the same CBV and expects both slots to read zero through a raw SRV. This is the shader regression originally contributed in #1916, adapted to use the current guest heap mirroring and table paths. Production code is unchanged. ## Verification - Same test on `120233cf912173e4411431a4b47579ef420310fe` immediately before #2449: both slots still returned `0x11223344` after the clear in six WARP runs. - On `96e178d56be53cf164942a260f420d36b7dfb37b` based on `842b0cb76f8f5fa9289bd779783c51ec24d75302`: both slots returned `0x11223344` before the clear and zero afterward in all six runs. - Full native WARP GPU suite: 247 passed and one ignored with each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed. Synthetic data only. Please retain the test's Git author if cherry-picked. If folded into another commit, please retain `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. Refs #1242
kotekompotek commented 2026-11-26 00:03:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:36:04Z.

Review: COMMENTED


Good coverage of the null-CBV path: reads through a raw ByteAddressBuffer of a cleared CBV must produce zeros in both the mirrored slot and a reused table slot — the hardware test exercises both rounds end to end. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066488090 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889#pullrequestreview-6066488090). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T23:36:04Z. **Review:** COMMENTED --- Good coverage of the null-CBV path: reads through a raw ByteAddressBuffer of a cleared CBV must produce zeros in both the mirrored slot and a reused table slot — the hardware test exercises both rounds end to end. LGTM.
fuzeofficlal commented 2026-11-26 00:03:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:18:39Z.


Verified 96e178d5 on Windows 11 (RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1) against main (842b0cb):

  • draw::tests::cleared_constant_view_reads_zero_as_a_raw_buffer passed on both RTX 5090 and WARP, under both default features and --features diagnostics with VICTORY_D3D12_DEBUG=1 (verifying both the mirrored slot and a copied table slot before and after create_cbv(null, null, ...)).
  • cargo clippy --locked -p victory-gpu --all-targets (default & --features diagnostics) 0 warnings; cargo xtask policy (191 files ok).

Clean regression coverage for #2449, ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177391262 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889#issuecomment-7177391262). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:18:39Z. --- Verified `96e178d5` on Windows 11 (RTX 5090 + WARP + `VICTORY_D3D12_DEBUG=1`) against `main` (`842b0cb`): - `draw::tests::cleared_constant_view_reads_zero_as_a_raw_buffer` passed on both RTX 5090 and WARP, under both default features and `--features diagnostics` with `VICTORY_D3D12_DEBUG=1` (verifying both the mirrored slot and a copied table slot before and after `create_cbv(null, null, ...)`). - `cargo clippy --locked -p victory-gpu --all-targets` (default & `--features diagnostics`) 0 warnings; `cargo xtask policy` (`191 files ok`). Clean regression coverage for `#2449`, ready to merge.
Marvisak commented 2026-11-26 05:04:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:27:49Z.


Automated triage for the maintainers.

Merge candidate. Adds cleared_constant_view_reads_zero_as_a_raw_buffer in victory-gpu/src/draw.rs: it writes a CBV, clears it with a null description, and reads the mirrored and a reused table slot through a raw SRV. It complements null_cbv_clears_a_stale_view by checking the host side (make and null_buffer_view for View::Constant(0, 0)), uses synthetic data only, and expects D3D12 null-CBV semantics.

CI: passing (the hosted check has no GPU, so this test likely returns early there).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182617257 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889#issuecomment-7182617257). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:27:49Z. --- <!-- victory-triage v1 head=96e178d56be53cf164942a260f420d36b7dfb37b verdict=merge-candidate at=2026-11-26T04:27:44Z --> Automated triage for the maintainers. **Merge candidate.** Adds `cleared_constant_view_reads_zero_as_a_raw_buffer` in `victory-gpu/src/draw.rs`: it writes a CBV, clears it with a null description, and reads the mirrored and a reused table slot through a raw SRV. It complements `null_cbv_clears_a_stale_view` by checking the host side (`make` and `null_buffer_view` for `View::Constant(0, 0)`), uses synthetic data only, and expects D3D12 null-CBV semantics. CI: passing (the hosted check has no GPU, so this test likely returns early there). --- _Generated by [Claude Code](https://claude.ai/code)_
Dukestar69 commented 2026-11-26 09:05:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T08:14:24Z.

Review: APPROVED


Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib cleared_constant_view_reads_zero_as_a_raw_buffer -- --test-threads=1: passed on RTX 5090 and WARP.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Clean synthetic GPU readback test covering cleared constant buffer descriptors.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6070527843 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889#pullrequestreview-6070527843). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T08:14:24Z. **Review:** APPROVED --- Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib cleared_constant_view_reads_zero_as_a_raw_buffer -- --test-threads=1`: passed on RTX 5090 and WARP. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Clean synthetic GPU readback test covering cleared constant buffer descriptors. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 13:03:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T12:07:22Z.

Review: APPROVED


Reviewed and verified at head 96e178d5 against origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1):

  • Design & correctness: cleared_constant_view_reads_zero_as_a_raw_buffer (crates/victory-gpu/src/draw.rs:2748-2806) adds end-to-end GPU readback coverage for null CBV clearing on both the mirrored host slot (0) and a reused dynamic table slot (visible.make_at(table_slot, &view)). Pre-filling the output buffer with 0xdead_beef before every dispatch prevents stale-output false positives, readable(..., ResourceType::Cbv, ...) is exercised for both live and cleared views, COM releases (buffer and heap) assert refcount 0, and GetDeviceRemovedReason().is_ok() is checked alongside [[0x1122_3344, 0x1122_3344], [0, 0]]. Test-only with no production changes or global state leaks.
  • Verification:
    • Clean git merge-tree against origin/main (63bcca43); cargo xtask policy (191 files ok); cargo clippy -p victory-gpu --all-targets -- -D warnings clean with default features and --all-features (both at 96e178d5 and merged onto 63bcca43).
    • RTX 5090 (default): 3/3 consecutive exact runs of cleared_constant_view_reads_zero_as_a_raw_buffer passed; parallel draw::tests 21/21 passed.
    • RTX 5090 + VICTORY_D3D12_DEBUG=1 (--features diagnostics): target test 1/1 and parallel draw::tests 21/21 passed (also verified merged onto 63bcca43: 1/1 passed with zero debug-layer errors).
    • WARP (VICTORY_D3D12_WARP=1) + VICTORY_D3D12_DEBUG=1 (--features diagnostics): target test 1/1 and parallel draw::tests 21/21 passed.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6073859289 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2889#pullrequestreview-6073859289). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T12:07:22Z. **Review:** APPROVED --- Reviewed and verified at head `96e178d5` against `origin/main` (`63bcca43`) on Windows 11 (RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`): - **Design & correctness**: `cleared_constant_view_reads_zero_as_a_raw_buffer` (`crates/victory-gpu/src/draw.rs:2748-2806`) adds end-to-end GPU readback coverage for null CBV clearing on both the mirrored host slot (`0`) and a reused dynamic table slot (`visible.make_at(table_slot, &view)`). Pre-filling the output buffer with `0xdead_beef` before every dispatch prevents stale-output false positives, `readable(..., ResourceType::Cbv, ...)` is exercised for both live and cleared views, COM releases (`buffer` and `heap`) assert refcount `0`, and `GetDeviceRemovedReason().is_ok()` is checked alongside `[[0x1122_3344, 0x1122_3344], [0, 0]]`. Test-only with no production changes or global state leaks. - **Verification**: - Clean `git merge-tree` against `origin/main` (`63bcca43`); `cargo xtask policy` (`191 files ok`); `cargo clippy -p victory-gpu --all-targets -- -D warnings` clean with default features and `--all-features` (both at `96e178d5` and merged onto `63bcca43`). - **RTX 5090 (default)**: 3/3 consecutive exact runs of `cleared_constant_view_reads_zero_as_a_raw_buffer` passed; parallel `draw::tests` **21/21** passed. - **RTX 5090 + `VICTORY_D3D12_DEBUG=1`** (`--features diagnostics`): target test 1/1 and parallel `draw::tests` **21/21** passed (also verified merged onto `63bcca43`: 1/1 passed with zero debug-layer errors). - **WARP (`VICTORY_D3D12_WARP=1`) + `VICTORY_D3D12_DEBUG=1`** (`--features diagnostics`): target test 1/1 and parallel `draw::tests` **21/21** passed. LGTM.
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/2889:upstream-pr/2889'
git switch 'upstream-pr/2889'

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/2889'
git switch 'upstream-pr/2889'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2889'
git switch 'upstream-pr/2889'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2889'
git switch 'main'
git merge --squash 'upstream-pr/2889'
git switch 'main'
git merge --ff-only 'upstream-pr/2889'
git switch 'main'
git merge 'upstream-pr/2889'
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
Marvisak/VIctory!2887
No description provided.