shader: derive mesh entry root inputs from the creation root signature #3446

Merged
Leyukaka merged 3 commits from upstream-pr/3446 into main 2026-11-29 12:06:44 +00:00
Leyukaka commented 2026-11-29 09:32:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T09:32:13Z.


Part of #3416

What changes

  • walk_raw_graphics_root factors out the SGPR walk from read_raw_graphics. Vertex and pixel stages start at s8 as before; the mesh stage starts at s16. Every parameter consumes its slots in signature order (table 1, constants N, root descriptor 2), then the resource heap SGPR.
  • derive_mesh_root_mapping maps descriptor tables, root constants and root SRVs visible to ALL or MESH, plus the directly indexed resource heap SGPR. Root CBVs and UAVs consume two slots each and stay unmapped. The sampler heap is not mapped for mesh.
  • derive_mesh_root_mapping refuses a guest root with DENY_MESH_SHADER_ROOT_ACCESS before any binding is derived (guest root denies mesh shader root access).
  • compile_dxil: a new .mslayout line guest_root derives the root inputs from the request's sibling serialized 1.1 .root. It is refused when repeated (duplicate guest_root) and when combined with table, constants, root_address or resource_heap in either order (guest_root excludes explicit root mapping lines).
  • docs/experiments/native-fixed-mesh57.md documents the line.

Evidence

Release preset: native_direct_mesh and native_compile_dxil_refusals pass (2/2).

Mutations (reverted after each run):

  • Skip the derivation (if (raw.guest_root) -> if (false && raw.guest_root)): both tests fail.
    • native_direct_mesh at derived-mesh-root: native compute +0x8: mesh scalar memory needs a verified guest root mapping: s_load_dwordx4
    • native_compile_dxil_refusals at check_mesh_report(...): {'examined': 5, 'no_refusal': 1, 'refused': 4, ...}
  • Remove the explicit-then-guest_root refusal: native_direct_mesh fails at conflicting-mesh-root-* (the compile succeeds). native_compile_dxil_refusals still passes; it does not cover this refusal.
  • Remove the deny-flag refusal, or test DENY_AMPLIFICATION_SHADER_ROOT_ACCESS instead: native_direct_mesh fails at deny-mesh-root-access (the compile succeeds).

Not covered

  • The pr test preset does not run native_direct_mesh or native_compile_dxil_refusals (not in its filter on 1a0120ba).
  • Root CBVs and UAVs on the mesh stage remain unmapped.
  • Runtime preparation is unchanged and still uses the reviewed profile.
  • Already the case on main, not introduced here:
    • An explicit mapping (table, constants, root_address) is still accepted with a root that has DENY_MESH_SHADER_ROOT_ACCESS; only guest_root checks the flag.
    • The offline path accepts a non-indexed table read whose slot is outside the table's declared descriptor ranges. Only runtime preparation refuses it (MS buffer slot outside a verified SRV range).

Merge notes

  • Based on e358cf5f, which includes #3443, #3444 and #3445.
  • git merge-tree is clean against main 20bd1553 and #3439 (6193c5a5).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5549438654 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3446). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T09:32:13Z. --- Part of #3416 ## What changes - `walk_raw_graphics_root` factors out the SGPR walk from `read_raw_graphics`. Vertex and pixel stages start at s8 as before; the mesh stage starts at s16. Every parameter consumes its slots in signature order (table 1, constants N, root descriptor 2), then the resource heap SGPR. - `derive_mesh_root_mapping` maps descriptor tables, root constants and root SRVs visible to ALL or MESH, plus the directly indexed resource heap SGPR. Root CBVs and UAVs consume two slots each and stay unmapped. The sampler heap is not mapped for mesh. - `derive_mesh_root_mapping` refuses a guest root with `DENY_MESH_SHADER_ROOT_ACCESS` before any binding is derived (`guest root denies mesh shader root access`). - `compile_dxil`: a new `.mslayout` line `guest_root` derives the root inputs from the request's sibling serialized 1.1 `.root`. It is refused when repeated (`duplicate guest_root`) and when combined with `table`, `constants`, `root_address` or `resource_heap` in either order (`guest_root excludes explicit root mapping lines`). - `docs/experiments/native-fixed-mesh57.md` documents the line. ## Evidence Release preset: `native_direct_mesh` and `native_compile_dxil_refusals` pass (2/2). Mutations (reverted after each run): - Skip the derivation (`if (raw.guest_root)` -> `if (false && raw.guest_root)`): both tests fail. - `native_direct_mesh` at `derived-mesh-root`: `native compute +0x8: mesh scalar memory needs a verified guest root mapping: s_load_dwordx4` - `native_compile_dxil_refusals` at `check_mesh_report(...)`: `{'examined': 5, 'no_refusal': 1, 'refused': 4, ...}` - Remove the explicit-then-`guest_root` refusal: `native_direct_mesh` fails at `conflicting-mesh-root-*` (the compile succeeds). `native_compile_dxil_refusals` still passes; it does not cover this refusal. - Remove the deny-flag refusal, or test `DENY_AMPLIFICATION_SHADER_ROOT_ACCESS` instead: `native_direct_mesh` fails at `deny-mesh-root-access` (the compile succeeds). ## Not covered - The `pr` test preset does not run `native_direct_mesh` or `native_compile_dxil_refusals` (not in its filter on 1a0120ba). - Root CBVs and UAVs on the mesh stage remain unmapped. - Runtime preparation is unchanged and still uses the reviewed profile. - Already the case on main, not introduced here: - An explicit mapping (`table`, `constants`, `root_address`) is still accepted with a root that has `DENY_MESH_SHADER_ROOT_ACCESS`; only `guest_root` checks the flag. - The offline path accepts a non-indexed table read whose slot is outside the table's declared descriptor ranges. Only runtime preparation refuses it (`MS buffer slot outside a verified SRV range`). ## Merge notes - Based on `e358cf5f`, which includes #3443, #3444 and #3445. - `git merge-tree` is clean against main `20bd1553` and #3439 (`6193c5a5`).
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
R0Y00/Xbox2Windows!3446
No description provided.