GPU: query view-heap limit upfront and clamp host scissors to targets (#726) #847

Closed
github-bot wants to merge 0 commits from github-bot/gh-847 into main AGit
Owner

@⁠Starchaser1024 on GitHub · 2026-11-28 07:41 UTC · original
Starchaser1024:fix/d3d12-heap-and-scissor-726 → main · +649 −24 · 2 files · 1 commits · closed without merging

Summary

Resolves the remaining two D3D12 debug-layer findings reported in #726 (id=645 and id=1378), complementing #753 (WM_CLOSE) and #787 (id=538 and id=646, which leaves 645 and 1378 untouched so the two PRs have no overlap).

Debug-layer message Count per 240 s debug run (#726) Root cause Fix
id=645 ERROR (CREATE_DESCRIPTOR_HEAP_INVALID_DESC) 2 -> 0 probe_view_limit unconditionally calls CreateDescriptorHeap with 4,194,304 and 2,097,152 shader-visible view descriptors before falling back to PORTABLE_VIEWS (1,000,000). NVIDIA GPUs report D3D12_RESOURCE_BINDING_TIER_3 while capping shader-visible view heaps at 1,000,000. Query D3D12_FEATURE_D3D12_OPTIONS19::MaxViewDescriptorHeapSize upfront (falling back to D3D12_FEATURE_D3D12_OPTIONS::ResourceBindingTier < Tier 3 => 1,000,000 on older runtimes). Skip probes above the device's reported ceiling while keeping 4,194,304 raw-twin heaps on Tier 3 adapters whose MaxViewDescriptorHeapSize >= 4,194,304.
id=1378 WARNING (DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA) ~670 -> 0 Under DLSS Quality at 1440p (1706x960 scene targets, 2560x1440 output), passes bind a 2560x1440 viewport and [0, 0, 2560, 1440] scissor while the bound RTV/DSV is 1706x960, so min(viewport_end, scissor_end) > min_target_dim. Track the smallest mip-adjusted (width, height) across bound live RTVs and DSV in draw::State (target_bounds) and clamp only the host scissor rectangles (host_scissors) across set_scissors, set_targets, replay, and mesh_scissor. Raw title viewports and raw State::scissors stay untouched so NDC-to-pixel rasterization math (including native_frontend_viewport) is preserved and widens back automatically when a larger target is bound.

Verification

Tested on NVIDIA GeForce RTX 5060 Ti (16 GB), Windows 11:

  • descriptor::host::view_limit_tests::shader_visible_view_heap_stays_within_device_limit: verifies D3D12_FEATURE_D3D12_OPTIONS19::MaxViewDescriptorHeapSize (1,000,000 on RTX 5060 Ti), confirms probe_view_limit and HostHeap::new stay within the limit without triggering id=645.
  • draw::scissor_clamp_tests::scissors_clamp_to_smallest_target_and_preserve_unbounded_draws and oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly: tests both bind orders (set_scissors before/after set_targets), multi-RTV minimum bounds, mip-sliced RTV bounds, State::replay, and executes a 2560x1440 viewport draw onto a 1706x960 RTV on the GPU verifying ID3D12InfoQueue cleanliness and pixel readback.
  • cargo test -p victory-gpu --locked: 456 passed, 0 failed.
  • cargo clippy --workspace --all-targets --all-features --locked: 0 warnings in changed files.
  • cargo xtask policy: 294 files ok.
**@⁠Starchaser1024** on GitHub · 2026-11-28 07:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/847) `Starchaser1024:fix/d3d12-heap-and-scissor-726` → `main` · +649 −24 · 2 files · 1 commits · closed without merging ## Summary Resolves the remaining two D3D12 debug-layer findings reported in #726 (`id=645` and `id=1378`), complementing #753 (`WM_CLOSE`) and #787 (`id=538` and `id=646`, which leaves `645` and `1378` untouched so the two PRs have no overlap). | Debug-layer message | Count per 240 s debug run (#726) | Root cause | Fix | | :--- | :--- | :--- | :--- | | `id=645` ERROR (`CREATE_DESCRIPTOR_HEAP_INVALID_DESC`) | `2 -> 0` | `probe_view_limit` unconditionally calls `CreateDescriptorHeap` with `4,194,304` and `2,097,152` shader-visible view descriptors before falling back to `PORTABLE_VIEWS` (`1,000,000`). NVIDIA GPUs report `D3D12_RESOURCE_BINDING_TIER_3` while capping shader-visible view heaps at `1,000,000`. | Query `D3D12_FEATURE_D3D12_OPTIONS19::MaxViewDescriptorHeapSize` upfront (falling back to `D3D12_FEATURE_D3D12_OPTIONS::ResourceBindingTier < Tier 3 => 1,000,000` on older runtimes). Skip probes above the device's reported ceiling while keeping `4,194,304` raw-twin heaps on Tier 3 adapters whose `MaxViewDescriptorHeapSize >= 4,194,304`. | | `id=1378` WARNING (`DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA`) | `~670 -> 0` | Under DLSS Quality at 1440p (`1706x960` scene targets, `2560x1440` output), passes bind a `2560x1440` viewport and `[0, 0, 2560, 1440]` scissor while the bound RTV/DSV is `1706x960`, so `min(viewport_end, scissor_end) > min_target_dim`. | Track the smallest mip-adjusted `(width, height)` across bound live RTVs and DSV in `draw::State` (`target_bounds`) and clamp only the host scissor rectangles (`host_scissors`) across `set_scissors`, `set_targets`, `replay`, and `mesh_scissor`. Raw title viewports and raw `State::scissors` stay untouched so NDC-to-pixel rasterization math (including `native_frontend_viewport`) is preserved and widens back automatically when a larger target is bound. | ## Verification Tested on **NVIDIA GeForce RTX 5060 Ti (16 GB)**, Windows 11: - `descriptor::host::view_limit_tests::shader_visible_view_heap_stays_within_device_limit`: verifies `D3D12_FEATURE_D3D12_OPTIONS19::MaxViewDescriptorHeapSize` (`1,000,000` on RTX 5060 Ti), confirms `probe_view_limit` and `HostHeap::new` stay within the limit without triggering `id=645`. - `draw::scissor_clamp_tests::scissors_clamp_to_smallest_target_and_preserve_unbounded_draws` and `oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly`: tests both bind orders (`set_scissors` before/after `set_targets`), multi-RTV minimum bounds, mip-sliced RTV bounds, `State::replay`, and executes a `2560x1440` viewport draw onto a `1706x960` RTV on the GPU verifying `ID3D12InfoQueue` cleanliness and pixel readback. - `cargo test -p victory-gpu --locked`: 456 passed, 0 failed. - `cargo clippy --workspace --all-targets --all-features --locked`: 0 warnings in changed files. - `cargo xtask policy`: 294 files ok.
Resolves the remaining two D3D12 debug-layer validation findings from #726
(`id=645` and `id=1378`, left untouched by #787):

- `id=645` (`D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_INVALID_DESC`): query
  `D3D12_FEATURE_D3D12_OPTIONS19::MaxViewDescriptorHeapSize` (falling back to
  `D3D12_FEATURE_D3D12_OPTIONS::ResourceBindingTier`) before `probe_view_limit`
  calls `CreateDescriptorHeap` with 4,194,304 and 2,097,152 descriptors. On
  NVIDIA Tier 3 GPUs on Windows 11 (`MaxViewDescriptorHeapSize = 1,000,000`),
  both invalid probes are skipped (`2 -> 0` `id=645` errors at startup), while
  Tier 3 GPUs that allow >= 4M descriptors still keep raw-twin heaps.
- `id=1378` (`D3D12_MESSAGE_ID_DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA`):
  track the smallest mip-adjusted `(width, height)` across bound live RTVs and
  DSV in `draw::State` and clamp host scissor rectangles to those bounds across
  `set_scissors`, `set_targets`, `replay`, and mesh scissor tests while keeping
  the title's viewports (preserving NDC rasterization math) and raw scissor
  state intact (`~670 -> 0` `id=1378` warnings per run on DLSS render targets).
Avoids D3D12 debug-layer performance warning id=820
(`CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE`) when `ClearRenderTargetView`
clears the synthetic 1706x960 render target, while still asserting zero errors
and zero `id=1378` (`DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA`) warnings.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:28:58 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-28 07:50 UTC · original

Ran the view-heap and scissor tests at c15d75d on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build; VICTORY_D3D12_ADAPTER=NVIDIA.

cargo test -p victory-gpu --lib -- view_limit_tests scissor_clamp_tests --test-threads=1
2 passed; 1 failed; 0 ignored; 0 measured; 489 filtered out      (exit 101)

The view-heap limit test and scissors_clamp_to_smallest_target_and_preserve_unbounded_draws pass. The GPU test oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly fails with an unexpected D3D12 debug-layer message: id=820 sev=2: ID3D12CommandList::ClearRenderTargetView: The application did not pass any clear value to resource creation.... I am reporting that exact output; I did not determine whether the warning comes from this change, from the test fixture or from this driver. The author's run was on an RTX 5060 Ti, so this adds the first RTX 5070 Ti datapoint in the thread.

Not tested: a real DLSS Quality frame, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-28 07:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/847#issuecomment-7236195317) Ran the view-heap and scissor tests at `c15d75d` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build; `VICTORY_D3D12_ADAPTER=NVIDIA`. ``` cargo test -p victory-gpu --lib -- view_limit_tests scissor_clamp_tests --test-threads=1 2 passed; 1 failed; 0 ignored; 0 measured; 489 filtered out (exit 101) ``` The view-heap limit test and `scissors_clamp_to_smallest_target_and_preserve_unbounded_draws` pass. The GPU test `oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly` fails with an unexpected D3D12 debug-layer message: `id=820 sev=2: ID3D12CommandList::ClearRenderTargetView: The application did not pass any clear value to resource creation...`. I am reporting that exact output; I did not determine whether the warning comes from this change, from the test fixture or from this driver. The author's run was on an RTX 5060 Ti, so this adds the first RTX 5070 Ti datapoint in the thread. Not tested: a real DLSS Quality frame, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠Starchaser1024 on GitHub · 2026-11-28 13:07 UTC · original

Thanks @⁠Aniseto for testing on RTX 5070 Ti with the D3D12 SDK layers enabled — great to see both id=645 ( iew_limit_tests) and id=1378 (DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA) stay at 0!

Good catch on id=820: the synthetic 1706x960 test texture in oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly was created with pOptimizedClearValue: None before ClearRenderTargetView(&[0.0; 4]), which emits D3D12 performance warning id=820 (CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE). Fixed in 4ce867f by passing the matching D3D12_CLEAR_VALUE at resource creation and filtering for errors + id=1378.

**@⁠Starchaser1024** on GitHub · 2026-11-28 13:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/847#issuecomment-7239702661) Thanks @⁠Aniseto for testing on RTX 5070 Ti with the D3D12 SDK layers enabled — great to see both id=645 ( iew_limit_tests) and id=1378 (DRAW_POTENTIALLY_OUTSIDE_OF_VALID_RENDER_AREA) stay at 0! Good catch on id=820: the synthetic 1706x960 test texture in oversized_2560x1440_viewport_and_scissor_on_1706x960_target_runs_cleanly was created with pOptimizedClearValue: None before ClearRenderTargetView(&[0.0; 4]), which emits D3D12 performance warning id=820 (CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE). Fixed in 4ce867f by passing the matching D3D12_CLEAR_VALUE at resource creation and filtering for errors + id=1378.
github-bot changed title from GPU: query view-heap limit upfront and clamp host scissors to targets (#726) to [pr-fix][rendering][dlss][NVIDIA] GPU: query view-heap limit upfront and clamp host scissors to targets (#726) 2026-11-29 01:55:13 +00:00
github-bot force-pushed github-bot/gh-847 from 4ce867f01e to e4657aad8f 2026-11-29 02:06:38 +00:00 Compare
github-bot changed title from [pr-fix][rendering][dlss][NVIDIA] GPU: query view-heap limit upfront and clamp host scissors to targets (#726) to GPU: query view-heap limit upfront and clamp host scissors to targets (#726) 2026-11-29 02:23:19 +00:00
github-bot closed this pull request 2026-11-29 07:48:19 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!847
No description provided.