Mesh fallback: pass buffer capacities as root constants instead of GetDimensions #70

Closed
github-bot wants to merge 630 commits from github-bot/gh-70 into main AGit
Owner

@⁠heresfilly09 on GitHub · 2026-11-27 23:43 UTC · original
heresfilly09:contrib/root-descriptor-caps → main · +53167 −2045 · 726 files · 584 commits · closed without merging

Summary

  • RWByteAddressBuffer.GetDimensions() returns 0 for root-descriptor-bound buffers on NVIDIA hardware, causing the allocation bounds check to drop every threadgroup — the mesh fallback draws nothing
  • Replace GetDimensions with an explicit cbuffer MsfbCaps : register(b1, space9) carrying the vertex and index buffer byte sizes as two root constants
  • Bind the caps in both FallbackRoot and FallbackTable root signature paths

Test plan

  • UserDataBindingTests.Every_stage_reads_its_user_sgprs(Buffer) passes on RTX 3060 (previously 60 pixel mismatches, all 0x00BADBAD)
  • UserDataBindingTests.Every_stage_reads_its_user_sgprs(UserConstants) passes on RTX 3060
  • Both variants still pass on WARP

Fixes #9

**@⁠heresfilly09** on GitHub · 2026-11-27 23:43 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/70) `heresfilly09:contrib/root-descriptor-caps` → `main` · +53167 −2045 · 726 files · 584 commits · closed without merging ## Summary - `RWByteAddressBuffer.GetDimensions()` returns 0 for root-descriptor-bound buffers on NVIDIA hardware, causing the allocation bounds check to drop every threadgroup — the mesh fallback draws nothing - Replace `GetDimensions` with an explicit `cbuffer MsfbCaps : register(b1, space9)` carrying the vertex and index buffer byte sizes as two root constants - Bind the caps in both `FallbackRoot` and `FallbackTable` root signature paths ## Test plan - [x] `UserDataBindingTests.Every_stage_reads_its_user_sgprs(Buffer)` passes on RTX 3060 (previously 60 pixel mismatches, all 0x00BADBAD) - [x] `UserDataBindingTests.Every_stage_reads_its_user_sgprs(UserConstants)` passes on RTX 3060 - [x] Both variants still pass on WARP Fixes #9
RWByteAddressBuffer.GetDimensions returns 0 for root-descriptor-bound buffers
on NVIDIA hardware, so the allocation bounds check dropped every group. Replace
the GetDimensions calls with an explicit cbuffer (MsfbCaps, b1 space9) carrying
the vertex and index buffer sizes, and bind it as two root constants in both the
FallbackRoot and FallbackTable paths.

Fixes #9
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 23:46:32 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-27 23:54 UTC · original

A problem outside the test harness, read at 93335f9 against main 2c16b3c and not run:

The new cbuffer MsfbCaps : register(b1, space9) (MeshComputeFallback.cs:96, read at :113) goes into every translated mesh fallback, but only the WARP harness's root signatures get a parameter for it (PipelineFactory.cs). The runtime builds its pipelines with BindlessRootSignature.Description ("the root signature every translated program runs with", BindlessRootSignature.cs:9). The loader's shim does so at Shims/D3D12X/Pipelines/BindlessRoot.cs:32, and PsoCommand.cs:93 and DispatchReplay.cs:35 do the same. That description has the user data at b0 and the fallback table (u0..u2, t0 in space 9) (BindlessRootSignature.cs:97-109), plus the launch parameters in space 10, and nothing at b1 space 9. A shader that reads a register its root signature does not declare fails pipeline creation, so with this change the real fallback pipelines would not build.

The runtime also never binds the fallback through root descriptors. It sets the table (CommandListBindingMethods.cs:1209, FallbackTableParameter), and #9 reports that the table variant (msfb_ngg_strips) draws correctly on the RTX 5070. The GetDimensions problem is confined to the harness's FallbackRoot layout (msfb_ngg_strips_rootdesc).

Two narrower options:

  • Emit the caps cbuffer only for the root-descriptor variant, and keep GetDimensions for the table.
  • Add the two constants to BindlessRootSignature and set them where the loader binds the table.

A test that builds a fallback program against BindlessRootSignature.Description would catch either way.

AI-assisted (Claude Code, Claude Opus 5.5 read the PR and main).

**@⁠upipibi** on GitHub · 2026-11-27 23:54 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/70#issuecomment-7230498005) A problem outside the test harness, read at `93335f9` against `main` `2c16b3c` and not run: The new `cbuffer MsfbCaps : register(b1, space9)` (`MeshComputeFallback.cs:96`, read at `:113`) goes into every translated mesh fallback, but only the WARP harness's root signatures get a parameter for it (`PipelineFactory.cs`). The runtime builds its pipelines with `BindlessRootSignature.Description` ("the root signature every translated program runs with", `BindlessRootSignature.cs:9`). The loader's shim does so at `Shims/D3D12X/Pipelines/BindlessRoot.cs:32`, and `PsoCommand.cs:93` and `DispatchReplay.cs:35` do the same. That description has the user data at b0 and the fallback table (u0..u2, t0 in space 9) (`BindlessRootSignature.cs:97-109`), plus the launch parameters in space 10, and nothing at b1 space 9. A shader that reads a register its root signature does not declare fails pipeline creation, so with this change the real fallback pipelines would not build. The runtime also never binds the fallback through root descriptors. It sets the table (`CommandListBindingMethods.cs:1209`, `FallbackTableParameter`), and #9 reports that the table variant (`msfb_ngg_strips`) draws correctly on the RTX 5070. The `GetDimensions` problem is confined to the harness's `FallbackRoot` layout (`msfb_ngg_strips_rootdesc`). Two narrower options: - Emit the caps cbuffer only for the root-descriptor variant, and keep `GetDimensions` for the table. - Add the two constants to `BindlessRootSignature` and set them where the loader binds the table. A test that builds a fallback program against `BindlessRootSignature.Description` would catch either way. AI-assisted (Claude Code, Claude Opus 5.5 read the PR and `main`).
github-bot force-pushed github-bot/gh-70 from 93335f92ab to 96850549ae 2026-11-28 00:10:23 +00:00 Compare
Author
Owner

@⁠heresfilly09 on GitHub · 2026-11-28 00:08 UTC · original · edited 2026-11-28 00:10 UTC

uuh ya thats true that the cbuffer would break pipeline creation against BindlessRootSignature since it has no b1 space 9.

Updated to option (a): MeshComputeFallback.Rewrite now takes an explicitCaps parameter (default false). The test harness passes true for the root-descriptor variant so the generated shader reads from cbuffer MsfbCaps instead of GetDimensions; the default keeps GetDimensions, so the runtime's root signature and table-bound path are unchanged.

Both UserDataBinding.Buffer and UserDataBinding.UserConstants still pass on RTX 3060 hardware.

**@⁠heresfilly09** on GitHub · 2026-11-28 00:08 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/70#issuecomment-7230679435) · edited 2026-11-28 00:10 UTC uuh ya thats true that the cbuffer would break pipeline creation against BindlessRootSignature since it has no b1 space 9. Updated to option (a): `MeshComputeFallback.Rewrite` now takes an `explicitCaps` parameter (default false). The test harness passes `true` for the root-descriptor variant so the generated shader reads from `cbuffer MsfbCaps` instead of `GetDimensions`; the default keeps `GetDimensions`, so the runtime's root signature and table-bound path are unchanged. Both `UserDataBinding.Buffer` and `UserDataBinding.UserConstants` still pass on RTX 3060 hardware.
Author
Owner

@⁠ThatRecompDev on GitHub · 2026-11-28 09:49 UTC · original

thanks for turning the review around so fast. it conflicts now because main already dropped the root-descriptor variant ("the table is the only binding, as the loader binds it"). nothing binds the fallback through root descriptors, and GetDimensions there is undefined on every vendor, not only NVIDIA.

I ran your branch anyway: both user-data rows and the table, rootdesc and overflow variants pass on WARP and on a 4090, and the runtime is untouched since both callers use the default. but rebased, explicitCaps would have no caller, and the default path's HLSL text changes a little, which rebuilds every fallback program for no gain. so I'd close this one unless you have a runtime path in mind that needs root descriptors.

**@⁠ThatRecompDev** on GitHub · 2026-11-28 09:49 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/70#issuecomment-7237485977) thanks for turning the review around so fast. it conflicts now because main already dropped the root-descriptor variant ("the table is the only binding, as the loader binds it"). nothing binds the fallback through root descriptors, and GetDimensions there is undefined on every vendor, not only NVIDIA. I ran your branch anyway: both user-data rows and the table, rootdesc and overflow variants pass on WARP and on a 4090, and the runtime is untouched since both callers use the default. but rebased, explicitCaps would have no caller, and the default path's HLSL text changes a little, which rebuilds every fallback program for no gain. so I'd close this one unless you have a runtime path in mind that needs root descriptors.
github-bot closed this pull request 2026-11-29 15:24:51 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.