GPU: zero graphics/mesh PSO padding bytes and deduplicate pipeline library stores #1041

Closed
gabrielcruzg3 wants to merge 1 commit from upstream-pr/1041 into main
gabrielcruzg3 commented 2026-11-24 15:15:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by gabrielcruzg3 on 2026-11-24T15:15:25Z.


Addresses #264 (Finding #3): \ID3D12PipelineLibrary\ description mismatches (id=972) caused by uninitialized struct padding bytes, and redundant \StorePipeline\ calls across worker threads (id=970).

Changes

  • \crates/victory-gpu/src/pipeline/host.rs: Copy graphics and mesh PSO sub-descriptors (\D3D12_BLEND_DESC, \D3D12_RASTERIZER_DESC, \D3D12_DEPTH_STENCIL_DESC, \D3D12_INPUT_ELEMENT_DESC, \D3D12_RT_FORMAT_ARRAY, and mesh \Stream) field-by-field into zeroed memory so padding bytes are deterministic.
  • \crates/victory-gpu/src/pipeline/library.rs: Track pipeline names already stored in the current run to avoid duplicate \StorePipeline\ calls across worker threads.

Verification

  • Added synthetic unit test \cleaned_graphics_descs_zero_padding_bytes.
  • Passed \cargo clippy -- -D warnings, \cargo test -p victory-gpu, and \cargo xtask policy.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6585047742 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1041). Originally posted by [gabrielcruzg3](https://github.com/gabrielcruzg3) on 2026-11-24T15:15:25Z. --- Addresses #264 (Finding #3): \ID3D12PipelineLibrary\ description mismatches (id=972) caused by uninitialized struct padding bytes, and redundant \StorePipeline\ calls across worker threads (id=970). ### Changes - \crates/victory-gpu/src/pipeline/host.rs\: Copy graphics and mesh PSO sub-descriptors (\D3D12_BLEND_DESC\, \D3D12_RASTERIZER_DESC\, \D3D12_DEPTH_STENCIL_DESC\, \D3D12_INPUT_ELEMENT_DESC\, \D3D12_RT_FORMAT_ARRAY\, and mesh \Stream\) field-by-field into zeroed memory so padding bytes are deterministic. - \crates/victory-gpu/src/pipeline/library.rs\: Track pipeline names already stored in the current run to avoid duplicate \StorePipeline\ calls across worker threads. ### Verification - Added synthetic unit test \cleaned_graphics_descs_zero_padding_bytes\. - Passed \cargo clippy -- -D warnings\, \cargo test -p victory-gpu\, and \cargo xtask policy\.
Zipettte commented 2026-11-24 17:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:30:25Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 4111946: cargo test -p victory-gpu passes, 44 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137771657 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1041#issuecomment-7137771657). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T16:30:25Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 4111946: `cargo test -p victory-gpu` passes, 44 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Bullet18x commented 2026-11-24 20:03:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bullet18x on 2026-11-24T19:49:34Z.


RTX 5090 A/B of the pipeline-library debug-layer messages, this PR vs #352 vs main, details and protocol in my comment on #352.

Build 972 (desc does not match) 970 (already exists)
main ffe310e 350 358
+ this PR (4111946) 288 211
+ #352 (f77bd28) 0 5

On this machine the remaining 972 / 970 pairs come from mesh pipelines stored without a topology (#352, #780); zeroing padding lowers the counts but does not remove them. The de-duplication of stores may still be worth keeping on top of #352 (the two conflict in pipeline/host.rs today).

AI use: Claude Code (Claude Opus 5.5) ran and counted; I checked the results.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142642517 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1041#issuecomment-7142642517). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-24T19:49:34Z. --- RTX 5090 A/B of the pipeline-library debug-layer messages, this PR vs #352 vs `main`, details and protocol in my comment on #352. | Build | 972 (desc does not match) | 970 (already exists) | |---|---|---| | `main` `ffe310e` | 350 | 358 | | + this PR (`4111946`) | 288 | 211 | | + #352 (`f77bd28`) | **0** | **5** | On this machine the remaining 972 / 970 pairs come from mesh pipelines stored without a topology (#352, #780); zeroing padding lowers the counts but does not remove them. The de-duplication of stores may still be worth keeping on top of #352 (the two conflict in `pipeline/host.rs` today). AI use: Claude Code (Claude Opus 5.5) ran and counted; I checked the results.
upstream-sync closed this pull request 2026-11-25 01:05:22 +00:00
Marvisak commented 2026-11-25 01:07:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:30:50Z.


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148585949 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1041#issuecomment-7148585949). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:30:50Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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!1041
No description provided.