GPU: report default buffer alignment from GetDesc #2688

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2690 into main
andrewpozdnakov7-jpg commented 2026-11-25 18:17:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T18:17:09Z.


Problem

GetDesc returns the creation description's alignment of zero for a buffer created with the default alignment. Native D3D12 reports the effective 64 KiB alignment for the same buffer. Zero is the creation shorthand for 64 KiB. D3D12 buffer description

Change

Resolve the default alignment in the buffer description returned by GetDesc.

Verification

  • The same synthetic 256-byte committed buffer and guest vtable query on main 13f91ca reports alignment 0, while native D3D12 WARP reports 65536. Both report 65536 after the change.
  • The explicit 65536-byte alignment control reports 65536 on both versions. All 18 resource tests, strict victory-gpu Clippy, and the staged policy passed.

Coordination claim

AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg [email protected].

<!-- greyfinch-sync:Marvisak/VIctory:issue:5496741687 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T18:17:09Z. --- ## Problem GetDesc returns the creation description's alignment of zero for a buffer created with the default alignment. Native D3D12 reports the effective 64 KiB alignment for the same buffer. Zero is the creation shorthand for 64 KiB. [D3D12 buffer description](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_resource_desc#buffers) ## Change Resolve the default alignment in the buffer description returned by GetDesc. ## Verification - The same synthetic 256-byte committed buffer and guest vtable query on main 13f91ca reports alignment 0, while native D3D12 WARP reports 65536. Both report 65536 after the change. - The explicit 65536-byte alignment control reports 65536 on both versions. All 18 resource tests, strict victory-gpu Clippy, and the staged policy passed. [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7170598805) AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.
necrobytes commented 2026-11-25 18:29:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by necrobytes on 2026-11-25T18:29:26Z.

Review: COMMENTED


I ran the guest GetDesc test on a Radeon RX 9060 XT under Linux with Wine and vkd3d-proton 3.2.0. With the test copied onto the 13f91ca implementation, a 256-byte buffer created with alignment 0 returned 0 through the guest vtable and 65536 through the host D3D12 API. The explicit 65536 control agreed on both paths.

At 78bf751, both paths returned 65536 for both inputs. All 18 resource::tests passed on the same adapter with --features diagnostics.

AI-assisted review (Codex).

<!-- greyfinch-sync:Marvisak/VIctory:review:6062899254 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#pullrequestreview-6062899254). Originally posted by [necrobytes](https://github.com/necrobytes) on 2026-11-25T18:29:26Z. **Review:** COMMENTED --- I ran the guest `GetDesc` test on a Radeon RX 9060 XT under Linux with Wine and vkd3d-proton 3.2.0. With the test copied onto the `13f91ca` implementation, a 256-byte buffer created with alignment `0` returned `0` through the guest vtable and `65536` through the host D3D12 API. The explicit `65536` control agreed on both paths. At `78bf751`, both paths returned `65536` for both inputs. All 18 `resource::tests` passed on the same adapter with `--features diagnostics`. AI-assisted review (Codex).
kotekompotek commented 2026-11-25 19:06:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:53:58Z.


Matches native semantics: GetDesc resolves the creation shorthand (0 = default 64 KiB for buffers) to the effective alignment. Verified the test compares against a real committed WARP buffer for both inputs, not just the constant.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171553502 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#issuecomment-7171553502). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T18:53:58Z. --- Matches native semantics: GetDesc resolves the creation shorthand (0 = default 64 KiB for buffers) to the effective alignment. Verified the test compares against a real committed WARP buffer for both inputs, not just the constant.
fuzeofficlal commented 2026-11-25 19:06:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T18:59:45Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of 78bf751c (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • RTX 5090: cargo test --locked -p victory-gpu --features diagnostics --lib resource: 20 passed, 0 failed (buffer_get_desc_reports_the_effective_alignment: input 65536 -> native 65536, guest 65536; input 0 -> native 65536, guest 65536).
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 199 passed, 0 failed, 1 ignored.

Review Notes

  • Scoping the 0 -> KIB_64 default strictly to desc.dimension == BUFFER matches D3D12 GetDesc() and resource::footprint without altering texture alignments (4 KiB / 64 KiB / 4 MiB MSAA). Clean and ready to merge.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7171680163 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#issuecomment-7171680163). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T18:59:45Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of `78bf751c` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` and `--features diagnostics`: **0 warnings**. - **RTX 5090:** `cargo test --locked -p victory-gpu --features diagnostics --lib resource`: **20 passed, 0 failed** (`buffer_get_desc_reports_the_effective_alignment`: `input 65536 -> native 65536, guest 65536`; `input 0 -> native 65536, guest 65536`). - **WARP (`VICTORY_D3D12_WARP=1`):** `cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1`: **199 passed, 0 failed, 1 ignored**. ### Review Notes - Scoping the `0 -> KIB_64` default strictly to `desc.dimension == BUFFER` matches D3D12 `GetDesc()` and `resource::footprint` without altering texture alignments (`4 KiB` / `64 KiB` / `4 MiB` MSAA). Clean and ready to merge.
oni-swr commented 2026-11-25 20:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T19:41:13Z.


Independent WARP/CPU verification

Head: 78bf751c5baa2f2f7f9b8d0386512c31d34de971
Base: origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca
Status: open, non-draft; clean merge tree; no oni-swr comment on this head.

Environment: Windows x64, WARP selected (VICTORY_WARP=1, VICTORY_D3D12_WARP=1), dxil.dll 1.8.2502.11 from Windows SDK 10.0.26100.0; rustc 1.98.1.

Commands (each with CARGO_TARGET_DIR=D:\victory-warp-2690-target and the WARP variables above):

  • Baseline and PR: cargo test --locked -p victory-gpu
  • Baseline and PR diagnostics: cargo test --locked -p victory-gpu --features diagnostics
  • PR targeted: cargo test --locked -p victory-gpu buffer_get_desc_reports_the_effective_alignment
  • PR lint: cargo clippy --locked -p victory-gpu --all-targets -- -D warnings

Results: default baseline 195 passed, 1 ignored; PR 196 passed, 1 ignored. Diagnostics baseline 197 passed, 1 failed, 1 ignored; PR 199 passed, 1 ignored. The baseline-only failure was memory::tests::a_submission_that_missed_leaves_the_copies_at_once; it passed in the PR run. Targeted alignment test 1/1 passed. Clippy passed.

Negative control: restored the old resource_desc behavior; the alignment regression failed (exit 101), as expected. No implementation bug found.

Not tested: physical GPU, retail title, release build. AI-assisted: Codex (gpt-6-luna).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172633883 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#issuecomment-7172633883). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T19:41:13Z. --- Independent WARP/CPU verification Head: `78bf751c5baa2f2f7f9b8d0386512c31d34de971` Base: `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` Status: open, non-draft; clean merge tree; no `oni-swr` comment on this head. Environment: Windows x64, WARP selected (`VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`), `dxil.dll` 1.8.2502.11 from Windows SDK 10.0.26100.0; rustc 1.98.1. Commands (each with `CARGO_TARGET_DIR=D:\victory-warp-2690-target` and the WARP variables above): - Baseline and PR: `cargo test --locked -p victory-gpu` - Baseline and PR diagnostics: `cargo test --locked -p victory-gpu --features diagnostics` - PR targeted: `cargo test --locked -p victory-gpu buffer_get_desc_reports_the_effective_alignment` - PR lint: `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` Results: default baseline 195 passed, 1 ignored; PR 196 passed, 1 ignored. Diagnostics baseline 197 passed, 1 failed, 1 ignored; PR 199 passed, 1 ignored. The baseline-only failure was `memory::tests::a_submission_that_missed_leaves_the_copies_at_once`; it passed in the PR run. Targeted alignment test 1/1 passed. Clippy passed. Negative control: restored the old `resource_desc` behavior; the alignment regression failed (exit 101), as expected. No implementation bug found. Not tested: physical GPU, retail title, release build. AI-assisted: Codex (gpt-6-luna).
Marvisak commented 2026-11-25 23:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:19:34Z.


Automated triage for the maintainers.

Merge candidate (recommend a look). resource_desc in crates/victory-gpu/src/resource.rs now reports 64 KiB instead of 0 for a buffer created with the default alignment. Nothing else changes: textures and explicit alignments are reported as before. The evidence is public D3D12 documentation plus a test that compares the guest's answer with a real committed buffer on the host device (it skips the comparison when there is no device), so the test checks native behaviour rather than repeating the code. The stored desc is not modified, so creation-side code that reads alignment == 0 is unaffected. One limit: the reference is PC D3D12; no title-side measurement shows the title reads this field.

CI: check passing on this head.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176222100 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#issuecomment-7176222100). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:19:34Z. --- <!-- victory-triage v1 head=78bf751c5baa2f2f7f9b8d0386512c31d34de971 verdict=merge-candidate at=2026-11-25T22:20:00Z --> Automated triage for the maintainers. **Merge candidate (recommend a look).** `resource_desc` in `crates/victory-gpu/src/resource.rs` now reports 64 KiB instead of 0 for a buffer created with the default alignment. Nothing else changes: textures and explicit alignments are reported as before. The evidence is public D3D12 documentation plus a test that compares the guest's answer with a real committed buffer on the host device (it skips the comparison when there is no device), so the test checks native behaviour rather than repeating the code. The stored `desc` is not modified, so creation-side code that reads `alignment == 0` is unaffected. One limit: the reference is PC D3D12; no title-side measurement shows the title reads this field. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-27 02:16:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:16:29Z.

Review: APPROVED


Looks good to me — accurate D3D12 GetDesc() behavior for buffers with zero impact on texture alignments or allocation footprint calculations.

Review & Verification Notes

  • crates/victory-gpu/src/resource.rs:2152-2162: resource_desc (vtable slot 0x50, the sole GetDesc entry point) normalizes desc.alignment == 0 to KIB_64 (D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT) strictly on the returned copy for dimension == BUFFER, leaving stored descriptions, texture alignments (4 KiB small / 4 MiB MSAA), and footprint/GetResourceAllocationInfo untouched.
  • Verified locally merged cleanly onto origin/main (63bcca43):
    • cargo xtask policy passes (191 files ok).
    • cargo clippy -p victory-gpu (--lib, --tests, and --features diagnostics --lib/--tests, -D warnings) is clean.
    • victory-gpu resource::tests passes (19/19) on discrete D3D12 hardware (VICTORY_D3D12_DEBUG=1, VICTORY_D3D12_GBV=1) — confirming input 65536 -> native 65536, guest 65536 and input 0 -> native 65536, guest 65536 — and on WARP (19/19, --features diagnostics, VICTORY_D3D12_DEBUG=1, VICTORY_D3D12_WARP=1).
<!-- greyfinch-sync:Marvisak/VIctory:review:6082621897 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2690#pullrequestreview-6082621897). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:16:29Z. **Review:** APPROVED --- Looks good to me — accurate D3D12 `GetDesc()` behavior for buffers with zero impact on texture alignments or allocation footprint calculations. ### Review & Verification Notes - `crates/victory-gpu/src/resource.rs:2152-2162`: `resource_desc` (vtable slot `0x50`, the sole `GetDesc` entry point) normalizes `desc.alignment == 0` to `KIB_64` (`D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT`) strictly on the returned copy for `dimension == BUFFER`, leaving stored descriptions, texture alignments (4 KiB small / 4 MiB MSAA), and `footprint`/`GetResourceAllocationInfo` untouched. - Verified locally merged cleanly onto `origin/main` (`63bcca43`): - `cargo xtask policy` passes (`191 files ok`). - `cargo clippy -p victory-gpu` (`--lib`, `--tests`, and `--features diagnostics` `--lib`/`--tests`, `-D warnings`) is clean. - `victory-gpu` `resource::tests` passes (`19/19`) on discrete D3D12 hardware (`VICTORY_D3D12_DEBUG=1`, `VICTORY_D3D12_GBV=1`) — confirming `input 65536 -> native 65536, guest 65536` and `input 0 -> native 65536, guest 65536` — and on WARP (`19/19`, `--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `VICTORY_D3D12_WARP=1`).
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/2690:upstream-pr/2690'
git switch 'upstream-pr/2690'

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