descriptor/host: default to PORTABLE_VIEWS (1M) so AMD GPUs match replacement shader heap slots #676

Open
ggwp wants to merge 1 commit from ggwp/Darner:fix/amd-portable-views into post-merge
Contributor

Contributor role (optional)

  • Fluxer ID: FomalhautCusimanse#7381

What it changes

  • The problem on post-merge: On Tier 3 AMD GPUs (tested on AMD Radeon 8060S / RDNA 3.5), probe_view_limit() allocates UNCAPPED_VIEWS (1 << 21 = 2,097,152) instead of PORTABLE_VIEWS (1,000,000). That places view_title_limit at 1,703,934, HEAP_VIEW_SLOT (dynamic_base) at 1,703,935, single/staged descriptors at 1,703,935..2,097,150, and view_heap_limit at 2,097,151.

    However, the precompiled replacement shaders in shaders/replace/ (85 .hlsl + trace_shadow_rays.hlsli) hardcode the 1M PORTABLE_VIEWS heap layout:

    • 86/86 files hardcode min(..., 999999u) — clamping every single/staged view on AMD down to slot 999,999 (in the middle of AMD's title descriptor region).
    • 80/86 files hardcode HEAP_VIEW_SLOT = 606783u — reading placed table_cbv rows from slot 606,783 instead of 1,703,935.
    • 52/86 files hardcode min(..., 606782u) — clamping title bindless indices >= 606,782 to a non-null slot on AMD.

    As a result, dynamically translated geometry/sky/fog/emissive shaders render, while lighting, shadows, and RTGI replacement shaders read/write invalid slots and leave opaque surfaces pitch black.

  • Fix: Default probe_view_limit() to PORTABLE_VIEWS (1,000,000) on all hosts via a testable helper select_view_heap_size(), with DARNER_UNCAPPED_VIEWS=1 kept as an opt-in switch for A/B testing. Added unit tests pinning that PORTABLE_VIEWS produces 606_782 / 606_783 / 999_999 and that the default path does not allocate an uncapped probe heap.

  • it affects every AMD GPU (RDNA 1 / 2 / 3 / 3.5 / 4 — RX 5000, 6000, 7000, 8000S/800M, 9000) and likely Intel Arc too, not just RDNA 3.5.

Here's why:

• NVIDIA caps shader-visible CBV/SRV/UAV descriptor heaps at 1,000,000 in its D3D12 driver, so fits(1 << 21) returns false and NVIDIA always takes PORTABLE_VIEWS (1,000,000) — matching the hardcoded 606782u / 606783u / 999999u constants in shaders/replace/.
• AMD (all Tier 3 RDNA GPUs, including RDNA 2/3/3.5/4 — the comment in wt-darner-post-merge/crates/darner-gpu/src/descriptor/host.rs:217-220 even notes UNCAPPED_VIEWS was added for an RDNA 3 RX 7900 XT) and Intel Arc allow CreateDescriptorHeap with 2,097,152 (1 << 21) descriptors, so fits(UNCAPPED_VIEWS) returns true and every one of them shifts dynamic/staged views to 1,703,935..2,097,150 — breaking all 85 replacement shaders in the exact same way.

How it was tested

  • Tested revision: 6e96150 (based on post-merge 28a9b42)

  • Commands and results:

    • cargo test --offline -p darner-gpu descriptor::host::tests — 2 passed, 0 failed
    • cargo clippy --offline -p darner-gpu --tests — 0 new warnings
    • cargo build --offline --release -p darner — succeeded
  • Changes a default: yes, for Tier 3 GPUs whose D3D12 driver accepts 1 << 21 shader-visible CBV/SRV/UAV descriptors (AMD). No change on NVIDIA or other cards already capped at PORTABLE_VIEWS (1,000,000).

  • A/B result on AMD Radeon 8060S (RDNA 3.5), Series X profile, 2560x1440, title upscaler (DLSS: OFF), RAY TRACING: HARDWARE, FG: OFF:

    A (off, UNCAPPED_VIEWS 2M) B (on, PORTABLE_VIEWS 1M)
    Visuals Opaque surfaces pitch black (only sky, fog, emissives, glass highlights visible) Full diffuse lighting, textures, shadows, foliage, water reflections, and hardware RTGI
    Frame time / FPS ~37.5 ms / 27 fps (7,503 draws) ~37.5–40.1 ms / 25–26.7 fps (6,716 draws)
  • Checks run on that revision: cargo test, cargo clippy, cargo build --release (all passed).

  • Gameplay: AMD Radeon 8060S (64 GB), Series X, 2560x1440, upscaler off (title upscaler), frame gen off, ray tracing hardware.

  • Hardware dependence: Affects Tier 3 GPUs that accept > 1,000,000 shader-visible descriptors (AMD RDNA). No behavioral change on NVIDIA.

  • Coverage gaps: Untested on other AMD RDNA generations (RDNA 2 / RDNA 3 / RDNA 4) and Intel Arc, though all share the same probe_view_limit() path and embedded shaders/replace/ constants.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on post-merge.
  • The diff contains no game files, code or assets.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found.
  • Replaces or overlaps: none found.
## Contributor role (optional) - Fluxer ID: FomalhautCusimanse#7381 ## What it changes - The problem on `post-merge`: On Tier 3 AMD GPUs (tested on AMD Radeon 8060S / RDNA 3.5), `probe_view_limit()` allocates `UNCAPPED_VIEWS` (`1 << 21` = 2,097,152) instead of `PORTABLE_VIEWS` (1,000,000). That places `view_title_limit` at `1,703,934`, `HEAP_VIEW_SLOT` (`dynamic_base`) at `1,703,935`, single/staged descriptors at `1,703,935..2,097,150`, and `view_heap_limit` at `2,097,151`. However, the precompiled replacement shaders in `shaders/replace/` (85 `.hlsl` + `trace_shadow_rays.hlsli`) hardcode the 1M `PORTABLE_VIEWS` heap layout: - 86/86 files hardcode `min(..., 999999u)` — clamping every single/staged view on AMD down to slot `999,999` (in the middle of AMD's title descriptor region). - 80/86 files hardcode `HEAP_VIEW_SLOT = 606783u` — reading placed `table_cbv` rows from slot `606,783` instead of `1,703,935`. - 52/86 files hardcode `min(..., 606782u)` — clamping title bindless indices `>= 606,782` to a non-null slot on AMD. As a result, dynamically translated geometry/sky/fog/emissive shaders render, while lighting, shadows, and RTGI replacement shaders read/write invalid slots and leave opaque surfaces pitch black. - Fix: Default `probe_view_limit()` to `PORTABLE_VIEWS` (`1,000,000`) on all hosts via a testable helper `select_view_heap_size()`, with `DARNER_UNCAPPED_VIEWS=1` kept as an opt-in switch for A/B testing. Added unit tests pinning that `PORTABLE_VIEWS` produces `606_782` / `606_783` / `999_999` and that the default path does not allocate an uncapped probe heap. - it affects every AMD GPU (RDNA 1 / 2 / 3 / 3.5 / 4 — RX 5000, 6000, 7000, 8000S/800M, 9000) and likely Intel Arc too, not just RDNA 3.5. Here's why: • NVIDIA caps shader-visible CBV/SRV/UAV descriptor heaps at 1,000,000 in its D3D12 driver, so fits(1 << 21) returns false and NVIDIA always takes PORTABLE_VIEWS (1,000,000) — matching the hardcoded 606782u / 606783u / 999999u constants in shaders/replace/. • AMD (all Tier 3 RDNA GPUs, including RDNA 2/3/3.5/4 — the comment in wt-darner-post-merge/crates/darner-gpu/src/descriptor/host.rs:217-220 even notes UNCAPPED_VIEWS was added for an RDNA 3 RX 7900 XT) and Intel Arc allow CreateDescriptorHeap with 2,097,152 (1 << 21) descriptors, so fits(UNCAPPED_VIEWS) returns true and every one of them shifts dynamic/staged views to 1,703,935..2,097,150 — breaking all 85 replacement shaders in the exact same way. ## How it was tested - Tested revision: `6e96150` (based on `post-merge` `28a9b42`) - Commands and results: - `cargo test --offline -p darner-gpu descriptor::host::tests` — 2 passed, 0 failed - `cargo clippy --offline -p darner-gpu --tests` — 0 new warnings - `cargo build --offline --release -p darner` — succeeded - Changes a default: yes, for Tier 3 GPUs whose D3D12 driver accepts `1 << 21` shader-visible CBV/SRV/UAV descriptors (AMD). No change on NVIDIA or other cards already capped at `PORTABLE_VIEWS` (`1,000,000`). - A/B result on AMD Radeon 8060S (RDNA 3.5), Series X profile, 2560x1440, title upscaler (`DLSS: OFF`), `RAY TRACING: HARDWARE`, `FG: OFF`: | | A (off, `UNCAPPED_VIEWS` 2M) | B (on, `PORTABLE_VIEWS` 1M) | |---|---|---| | Visuals | Opaque surfaces pitch black (only sky, fog, emissives, glass highlights visible) | Full diffuse lighting, textures, shadows, foliage, water reflections, and hardware RTGI | | Frame time / FPS | ~37.5 ms / 27 fps (7,503 draws) | ~37.5–40.1 ms / 25–26.7 fps (6,716 draws) | - Checks run on that revision: `cargo test`, `cargo clippy`, `cargo build --release` (all passed). - Gameplay: AMD Radeon 8060S (64 GB), Series X, 2560x1440, upscaler off (title upscaler), frame gen off, ray tracing hardware. - Hardware dependence: Affects Tier 3 GPUs that accept `> 1,000,000` shader-visible descriptors (AMD RDNA). No behavioral change on NVIDIA. - Coverage gaps: Untested on other AMD RDNA generations (RDNA 2 / RDNA 3 / RDNA 4) and Intel Arc, though all share the same `probe_view_limit()` path and embedded `shaders/replace/` constants. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `post-merge`. - [x] The diff contains no game files, code or assets. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found. - Replaces or overlaps: none found.
TrustNo1 changed title from [pr-fix][rendering][AMD] descriptor/host: default to PORTABLE_VIEWS (1M) so AMD GPUs match replacement shader heap slots to descriptor/host: default to PORTABLE_VIEWS (1M) so AMD GPUs match replacement shader heap slots 2026-12-06 03:25:17 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/amd-portable-views:ggwp-fix/amd-portable-views'
git switch 'ggwp-fix/amd-portable-views'

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 'post-merge'
git merge --no-ff 'ggwp-fix/amd-portable-views'
git switch 'ggwp-fix/amd-portable-views'
git rebase 'post-merge'
git switch 'post-merge'
git merge --ff-only 'ggwp-fix/amd-portable-views'
git switch 'ggwp-fix/amd-portable-views'
git rebase 'post-merge'
git switch 'post-merge'
git merge --no-ff 'ggwp-fix/amd-portable-views'
git switch 'post-merge'
git merge --squash 'ggwp-fix/amd-portable-views'
git switch 'post-merge'
git merge --ff-only 'ggwp-fix/amd-portable-views'
git switch 'post-merge'
git merge 'ggwp-fix/amd-portable-views'
git push origin 'post-merge'
Sign in to join this conversation.
No reviewers
No milestone
No project
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
TrustNo1/Darner!676
No description provided.