GPU: read DRED constant-view words without VirtualQuery #1344

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/1344 into main
fuzeofficlal commented 2026-11-24 17:34:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:34:08Z.


Fixes #913.

Summary

  • Replace the per-draw texture::committed (VirtualQuery region walk) + raw unaligned read in draw::describe (#[cfg(feature = "diagnostics")]) with first_constant_words, reading 16 bytes directly via host::read_into (ReadProcessMemory) and decoding four little-endian f32 values without unsafe.
  • Preserves exact Constant({address:#x}, {size}) {words:?} formatting (including -0.0) while skipping null, reserved (MEM_RESERVE), or partially unmapped page boundaries without walking the process's memory regions on every draw/dispatch.

Verification

  • Added draw::tests::constant_view_notes_read_committed_words_and_skip_unmapped_pages testing unaligned committed f32 words, short buffers, null addresses, MEM_RESERVE pages, and cross-page committed/uncommitted boundaries:
    • NVIDIA GeForce RTX 5090 (VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1): passed (0 debug errors)
    • AMD Radeon(TM) Graphics (VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1): passed (0 debug errors)
    • Microsoft D3D12 WARP (VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1): passed (0 debug errors)
  • cargo clippy --workspace --all-targets --all-features and cargo xtask policy: passed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6587714837 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1344). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:34:08Z. --- Fixes #913. ### Summary - Replace the per-draw `texture::committed` (`VirtualQuery` region walk) + raw unaligned read in `draw::describe` (`#[cfg(feature = "diagnostics")]`) with `first_constant_words`, reading 16 bytes directly via `host::read_into` (`ReadProcessMemory`) and decoding four little-endian `f32` values without `unsafe`. - Preserves exact `Constant({address:#x}, {size}) {words:?}` formatting (including `-0.0`) while skipping null, reserved (`MEM_RESERVE`), or partially unmapped page boundaries without walking the process's memory regions on every draw/dispatch. ### Verification - Added `draw::tests::constant_view_notes_read_committed_words_and_skip_unmapped_pages` testing unaligned committed `f32` words, short buffers, null addresses, `MEM_RESERVE` pages, and cross-page committed/uncommitted boundaries: - **NVIDIA GeForce RTX 5090** (`VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1`): passed (`0` debug errors) - **AMD Radeon(TM) Graphics** (`VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1`): passed (`0` debug errors) - **Microsoft D3D12 WARP** (`VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1`): passed (`0` debug errors) - `cargo clippy --workspace --all-targets --all-features` and `cargo xtask policy`: passed.
catminou4 commented 2026-11-24 21:02:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:07:46Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS, so this is source review plus the PR's own Windows tests.

Under diagnostics, constant-view words for describe are now read with ReadProcessMemory on the 16-byte span instead of texture::committed (which walks pages via VirtualQuery). Falls back to the short Debug form when the read fails. Feature-gated, diagnostics-only, no behavior change to rendering. Fine.

<!-- greyfinch-sync:Marvisak/VIctory:review:6046527639 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1344#pullrequestreview-6046527639). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:07:46Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS, so this is source review plus the PR's own Windows tests. Under `diagnostics`, constant-view words for `describe` are now read with `ReadProcessMemory` on the 16-byte span instead of `texture::committed` (which walks pages via VirtualQuery). Falls back to the short `Debug` form when the read fails. Feature-gated, diagnostics-only, no behavior change to rendering. Fine.
upstream-sync closed this pull request 2026-11-25 01:06:16 +00:00
Marvisak commented 2026-11-25 01:08:09 +00:00 (Migrated from github.com)

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


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

Main's describe() already reads the constant view's words through read_into without VirtualQuery (draw.rs, fixed today for the same per-draw cost).

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:7148712810 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1344#issuecomment-7148712810). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:37:48Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Main's describe() already reads the constant view's words through read_into without VirtualQuery (draw.rs, fixed today for the same per-draw cost). 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!1344
No description provided.