d3d12_xs: remap Xbox Series PSO stream subobjects (AS=23, MS=24, ext 25..30) #168

Closed
github-bot wants to merge 2 commits from gh-pr/168/head into gh-pr/168/base
Owner

@⁠GDAgent on GitHub · 2026-11-22 17:27 UTC · original
GDAgent:fix/d3d12-xbox-pso-stream-subobjects → main · +610 −24 · 1 files · 2 commits · closed without merging

Library / area: d3d12_xs (mesh_pso.rs)

Exports changed (exports.txt rows): none

Source of the behaviour: console debug UMD xgs12_10d.dll 10.0.22000.3160 (RVAs for that file):

  • D3d12Device2_CreatePipelineState (0x8aa40) calls the stream parser 0x8e100. Its switch over types 0..=30 gives the record sizes in CONSOLE_RECORD_SIZE. 0..=22 match PC d3d12.h; 23 = AS and 24 = MS (24 B each); 25..30 = 40/32/64/16/32/16 B.
  • Builder vtable 0x1f5070, handlers 0x8a540 (25), 0x8a5f0 (26), 0x8a6d0 (27), 0x8a7f0 (28), 0x8a870 (29), 0x8ecb0 (30). Each of 25-29 sets an extension bit only for a non-default payload; bits 0-3 become the CreateGraphicsPipelineStateX extended descs 0-3.
  • Depth-stencil-options packing: 0xc23c0 (DB_DEPTH_CONTROL, DB_STENCILREFMASK(_BF)). Stencil-op table: 0x2332d0. DepthBoundsDisable overwrite: 0x8afe2. Shader-limit validators: 0xa9660 (graphics), 0xa9850 (compute).

Changes:

  • Classification: the stream is parsed with both the PC and the console record-size tables.
    • Console only when the console table alone parses it (type 23, or console sizes for 25-30).
    • PC only when the PC table alone parses it, passed through untouched. PC Agility 26 DEPTH_STENCIL2, 27 RASTERIZER1, 28 RASTERIZER2 and 29 SERIALIZED_ROOT_SIGNATURE now have PC layouts.
    • When both parse to the same records, a type-24 shader's PSV0 stage decides (mesh → console, amplification → PC). Anything else is refused with E_INVALIDARG.
  • Console subobjects: 23/24 → PC AS/MS (a null shader is omitted). For 25-30:
    • 25 pixel-shader options and 28 tessellation parameters: dropped when default (console no-op), otherwise refused.
    • 26 DEPTH_STENCIL_OPTIONS: default dropped, otherwise mapped. STENCILOPVAL 0 turns INCR/DECR ops into KEEP; BACKFACE_ENABLE 0 copies the front-face state to the back face; back-face masks that differ from the front ones become DEPTH_STENCIL2 when IndependentFrontAndBackStencilRefMaskSupported. Colour-writes-on-depth bits, non-zero stencil test refs, other op values, and differing masks without device support are refused.
    • 27/29 CU and wave scheduling limits: dropped, logged as hints. 30 (pointer, never read by the console build path): dropped and logged.
  • Reuses pso_ext's DsExt and Block field tables. mesh_dxil_topology now shares the PSV0 walk with the new stage check.
  • Logs the raw subobject types of the first 8 console-numbered PSOs and each distinct extension decision with its payload and reason.

Tests:

  • cargo test -p d3d12_xs --lib mesh_pso: 14 passed, 0 failed.
    • Console table vs PC layout; console AS/MS remap (including a PSV0-decided lone MS); PC passthrough of 26-29.
    • Ambiguous and malformed refusal.
    • Every 25-30 decision, including 26 → DEPTH_STENCIL2.
  • cargo test -p d3d12_xs --lib: 553 passed, 4 failed. The same 4 fail on clean main (546/4): alias::msaa_depth_…, placed_offset::uneven_views_…, title_shadow::buffer_then_texture_…, xs_exports::console_fixed_tests.
  • Native Windows 11; not run under Proton.

Not verified in a title: an earlier UE5 title run sent only extension 26, with back masks 0xff/0xff or 0xff/0xf4 and op values 0/0 or 1/1. This build has not been run against a title. Rendering through the mapped stencil state is untested on hardware.

  • cargo test -p d3d12_xs --lib mesh_pso passes
  • No game or console files and no binaries included
  • No accept-and-drop: every dropped subobject is a proven console no-op or a scheduling hint, logged with its reason; everything else is mapped or refused
**@⁠GDAgent** on GitHub · 2026-11-22 17:27 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168) `GDAgent:fix/d3d12-xbox-pso-stream-subobjects` → `main` · +610 −24 · 1 files · 2 commits · closed without merging **Library / area:** d3d12_xs (`mesh_pso.rs`) **Exports changed (exports.txt rows):** none **Source of the behaviour:** console debug UMD `xgs12_10d.dll` 10.0.22000.3160 (RVAs for that file): - `D3d12Device2_CreatePipelineState` (`0x8aa40`) calls the stream parser `0x8e100`. Its `switch` over types `0..=30` gives the record sizes in `CONSOLE_RECORD_SIZE`. `0..=22` match PC `d3d12.h`; `23` = AS and `24` = MS (24 B each); `25..30` = 40/32/64/16/32/16 B. - Builder vtable `0x1f5070`, handlers `0x8a540` (25), `0x8a5f0` (26), `0x8a6d0` (27), `0x8a7f0` (28), `0x8a870` (29), `0x8ecb0` (30). Each of 25-29 sets an extension bit only for a non-default payload; bits 0-3 become the `CreateGraphicsPipelineStateX` extended descs 0-3. - Depth-stencil-options packing: `0xc23c0` (`DB_DEPTH_CONTROL`, `DB_STENCILREFMASK(_BF)`). Stencil-op table: `0x2332d0`. DepthBoundsDisable overwrite: `0x8afe2`. Shader-limit validators: `0xa9660` (graphics), `0xa9850` (compute). Changes: - **Classification:** the stream is parsed with both the PC and the console record-size tables. - Console only when the console table alone parses it (type 23, or console sizes for 25-30). - PC only when the PC table alone parses it, passed through untouched. PC Agility `26 DEPTH_STENCIL2`, `27 RASTERIZER1`, `28 RASTERIZER2` and `29 SERIALIZED_ROOT_SIGNATURE` now have PC layouts. - When both parse to the same records, a type-24 shader's PSV0 stage decides (mesh → console, amplification → PC). Anything else is refused with `E_INVALIDARG`. - **Console subobjects:** `23`/`24` → PC `AS`/`MS` (a null shader is omitted). For 25-30: - `25` pixel-shader options and `28` tessellation parameters: dropped when default (console no-op), otherwise refused. - `26` `DEPTH_STENCIL_OPTIONS`: default dropped, otherwise mapped. `STENCILOPVAL 0` turns `INCR/DECR` ops into `KEEP`; `BACKFACE_ENABLE 0` copies the front-face state to the back face; back-face masks that differ from the front ones become `DEPTH_STENCIL2` when `IndependentFrontAndBackStencilRefMaskSupported`. Colour-writes-on-depth bits, non-zero stencil test refs, other op values, and differing masks without device support are refused. - `27`/`29` CU and wave scheduling limits: dropped, logged as hints. `30` (pointer, never read by the console build path): dropped and logged. - Reuses `pso_ext`'s `DsExt` and `Block` field tables. `mesh_dxil_topology` now shares the PSV0 walk with the new stage check. - Logs the raw subobject types of the first 8 console-numbered PSOs and each distinct extension decision with its payload and reason. Tests: - `cargo test -p d3d12_xs --lib mesh_pso`: 14 passed, 0 failed. - Console table vs PC layout; console AS/MS remap (including a PSV0-decided lone MS); PC passthrough of 26-29. - Ambiguous and malformed refusal. - Every 25-30 decision, including 26 → `DEPTH_STENCIL2`. - `cargo test -p d3d12_xs --lib`: 553 passed, 4 failed. The same 4 fail on clean `main` (546/4): `alias::msaa_depth_…`, `placed_offset::uneven_views_…`, `title_shadow::buffer_then_texture_…`, `xs_exports::console_fixed_tests`. - Native Windows 11; not run under Proton. **Not verified in a title:** an earlier UE5 title run sent only extension 26, with back masks `0xff/0xff` or `0xff/0xf4` and op values `0/0` or `1/1`. This build has not been run against a title. Rendering through the mapped stencil state is untested on hardware. - [x] `cargo test -p d3d12_xs --lib mesh_pso` passes - [x] No game or console files and no binaries included - [x] No accept-and-drop: every dropped subobject is a proven console no-op or a scheduling hint, logged with its reason; everything else is mapped or refused
In the Xbox Series D3D12XBOX pipeline-stream ABI, subobject 23 is the amplification shader (24B) and 24 is the mesh shader (24B), shifted down by one from PC d3d12.h (AS=24, MS=25), while types 25..=30 are Xbox-only extension descriptors (40, 32, 64, 16, 32, 16 bytes).

Normalize streams in xbox_to_pc_stream only when clearly console-numbered (containing 23, any of 26..=30, or 24 without 25); pass through PC-numbered (both 24 and 25) and basic (<=22) streams unchanged; refuse and log ambiguous streams mixing 25 with 23 or 26..=30. Log the raw subobject type list for the first 8 console stream PSOs.
Classify a CreatePipelineState stream as console-numbered only when it parses with the console record-size table and not the PC one (type 23, or console sizes for 25-30); a stream that parses both ways is console only when its type-24 shader is a mesh shader by PSV0 stage, PC when it is an amplification shader, and refused otherwise. PC Agility types 26-29 (DEPTH_STENCIL2, RASTERIZER1, RASTERIZER2, SERIALIZED_ROOT_SIGNATURE) now have PC layouts and pass through untouched.

Each console extension subobject is handled from the console runtime's behaviour: 25 pixel-shader options and 28 tessellation parameters are dropped only when default and refused otherwise; 26 DEPTH_STENCIL_OPTIONS is mapped (STENCILOPVAL 0 turns INCR/DECR into KEEP, BACKFACE_ENABLE 0 copies the front-face state, differing back-face masks become DEPTH_STENCIL2 when IndependentFrontAndBackStencilRefMaskSupported) and refused for colour-on-depth bits, non-zero stencil test refs or other op values; 27 and 29 CU/wave scheduling limits and the never-read 30 pointer are dropped with that reason in the log.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:12:29 +00:00
github-bot closed this pull request 2026-11-26 06:12:29 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 17:36 UTC · original

Thanks, the console stream numbering from the UMD parser is useful. We can't take the remap unconditionally yet, though. xbox_to_pc_stream runs on every console CreatePipelineState stream. We can't yet confirm that every title we run (Fortnite, XDefiant, Minecraft) sends console numbering. If one of them sends PC numbering, AS=24 / MS=25, its MS would be dropped as an extension and its AS treated as the MS.

Please change it to:

  1. Remap only when the stream is clearly console-numbered: it contains a 23, or any of 26..=30, or a 24 without a 25.
    • Pass through unchanged: a stream with both 24 and 25, or with nothing above 22.
    • Refuse and log: a stream with a 25 plus a 23 or any of 26..=30, since that's ambiguous.
  2. Log the raw subobject type list for the first 8 console stream PSOs, so title runs show which numbering each game really sends. Once the logs agree, we can make the remap unconditional.
  3. Unit tests for all three branches: console-numbered remap, PC-numbered passthrough, and ambiguous refusal. Keep your existing size and duplicate tests.

Everything else is fine as written. Once it's updated I'll apply it with your authorship kept.

**@⁠omonkeyz** on GitHub · 2026-11-22 17:36 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7082973293) Thanks, the console stream numbering from the UMD parser is useful. We can't take the remap unconditionally yet, though. `xbox_to_pc_stream` runs on every console `CreatePipelineState` stream. We can't yet confirm that every title we run (Fortnite, XDefiant, Minecraft) sends console numbering. If one of them sends PC numbering, AS=24 / MS=25, its MS would be dropped as an extension and its AS treated as the MS. Please change it to: 1. **Remap only when the stream is clearly console-numbered:** it contains a 23, or any of 26..=30, or a 24 without a 25. - Pass through unchanged: a stream with both 24 and 25, or with nothing above 22. - Refuse and log: a stream with a 25 plus a 23 or any of 26..=30, since that's ambiguous. 2. **Log the raw subobject type list for the first 8 console stream PSOs,** so title runs show which numbering each game really sends. Once the logs agree, we can make the remap unconditional. 3. **Unit tests for all three branches:** console-numbered remap, PC-numbered passthrough, and ambiguous refusal. Keep your existing size and duplicate tests. Everything else is fine as written. Once it's updated I'll apply it with your authorship kept.
Author
Owner

@⁠GDAgent on GitHub · 2026-11-22 18:42 UTC · original

Updated per your review and rebased onto current main:

  • Conditional remap: xbox_to_pc_stream now remaps only when the stream is clearly console-numbered (contains 23, any of 26..=30, or 24 without 25).
  • Passthrough: streams with both 24 and 25 (PC-numbered) or nothing above 22 (as well as PC-sized 25 alone) pass through unchanged.
  • Ambiguous refusal: streams mixing 25 with 23 or 26..=30 (or a 40-byte 25 without console-only subobjects) are refused with an explicit error and logged in CreatePipelineState.
  • Raw subobject logging: CreatePipelineState logs the raw subobject type list and classification (console-remap, passthrough, ambiguous-refused) for the first 8 console stream PSOs.
  • Unit tests: added coverage for all three branches (xbox_stream_remaps_as_ms_and_drops_console_extensions, xbox_stream_passes_through_pc_numbered_and_basic_streams, xbox_stream_refuses_ambiguous_subobject_25_mixes) alongside the existing record-size, duplicate, unknown-type, and truncation checks.

Ready for re-review!

**@⁠GDAgent** on GitHub · 2026-11-22 18:42 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7083813107) Updated per your review and rebased onto current `main`: - **Conditional remap:** `xbox_to_pc_stream` now remaps only when the stream is clearly console-numbered (contains `23`, any of `26..=30`, or `24` without `25`). - **Passthrough:** streams with both `24` and `25` (PC-numbered) or nothing above `22` (as well as PC-sized `25` alone) pass through unchanged. - **Ambiguous refusal:** streams mixing `25` with `23` or `26..=30` (or a 40-byte `25` without console-only subobjects) are refused with an explicit error and logged in `CreatePipelineState`. - **Raw subobject logging:** `CreatePipelineState` logs the raw subobject type list and classification (`console-remap`, `passthrough`, `ambiguous-refused`) for the first 8 console stream PSOs. - **Unit tests:** added coverage for all three branches (`xbox_stream_remaps_as_ms_and_drops_console_extensions`, `xbox_stream_passes_through_pc_numbered_and_basic_streams`, `xbox_stream_refuses_ambiguous_subobject_25_mixes`) alongside the existing record-size, duplicate, unknown-type, and truncation checks. Ready for re-review!
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 18:54 UTC · original

Thanks for the update. It applies cleanly on current main, and the d3d12_xs lib tests pass (552/0). Because it changes every CreatePipelineState call, it is waiting on a go/no-go from the graphics lead. The open questions:

  • What evidence supports the console record sizes for types 25-30?
  • Dropping types 26-30 only logs them. Our no-accept-and-drop rule needs those subobjects handled or refused.
  • PC Agility types 26-29 could be misclassified as console records.
**@⁠omonkeyz** on GitHub · 2026-11-22 18:54 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7083964562) Thanks for the update. It applies cleanly on current main, and the d3d12_xs lib tests pass (552/0). Because it changes every CreatePipelineState call, it is waiting on a go/no-go from the graphics lead. The open questions: - What evidence supports the console record sizes for types 25-30? - Dropping types 26-30 only logs them. Our no-accept-and-drop rule needs those subobjects handled or refused. - PC Agility types 26-29 could be misclassified as console records.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 18:55 UTC · original

The graphics lead has reviewed this, and it needs changes before it can land:

  1. Classify a stream as console-numbered only on unambiguous evidence: a type 23 is present, or a subobject's size or alignment matches the console stream-parse table and not the PC one. PC Agility types 26-29 (DEPTH_STENCIL2, RASTERIZER1/2, SERIALIZED_ROOT_SIGNATURE) must pass through untouched.
  2. No accept-and-drop. For each console subobject 25-30, cite the console runtime's parse-table entry, its size, and what the driver does with the payload:
    • a proven no-op or hint may be dropped, with that citation in the log text;
    • state-bearing semantics map to the PC equivalent;
    • anything else is refused with a logged E_INVALIDARG naming the subobject and its payload.
  3. Take record sizes from that table, with the reference in the PR, not hardcoded.
  4. Log the raw subobject type list for the first 8 console-numbered PSOs.
  5. Add tests for the console remap, PC passthrough of 26-29, ambiguous refusal, and each 25-30 decision.
    Thanks, the structure is close.
**@⁠omonkeyz** on GitHub · 2026-11-22 18:55 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7083970570) The graphics lead has reviewed this, and it needs changes before it can land: 1. Classify a stream as console-numbered only on unambiguous evidence: a type 23 is present, or a subobject's size or alignment matches the console stream-parse table and not the PC one. PC Agility types 26-29 (DEPTH_STENCIL2, RASTERIZER1/2, SERIALIZED_ROOT_SIGNATURE) must pass through untouched. 2. No accept-and-drop. For each console subobject 25-30, cite the console runtime's parse-table entry, its size, and what the driver does with the payload: - a proven no-op or hint may be dropped, with that citation in the log text; - state-bearing semantics map to the PC equivalent; - anything else is refused with a logged E_INVALIDARG naming the subobject and its payload. 3. Take record sizes from that table, with the reference in the PR, not hardcoded. 4. Log the raw subobject type list for the first 8 console-numbered PSOs. 5. Add tests for the console remap, PC passthrough of 26-29, ambiguous refusal, and each 25-30 decision. Thanks, the structure is close.
Author
Owner

@⁠GDAgent on GitHub · 2026-11-22 19:26 UTC · original

Thanks for the detailed review. Reworked in 49f8ed3 (rebased onto current main, #176 code kept). All evidence is from the console debug UMD xgs12_10d.dll 10.0.22000.3160 (RVAs below are for that file).

Where the table comes from. D3d12Device2_CreatePipelineState (0x8aa40) runs the stream parser 0x8e100: a switch over types 0..=30 (anything above 30 is rejected) that hands each payload to a builder vtable (0x1f5070) and advances by a fixed record size. That size table is now the CONSOLE_RECORD_SIZE constant:

0:16, 1-6:24, 7:40, 8:336, 9:8, 10:48, 11:56, 12:24, 13:8, 14:8, 15:40, 16:8, 17:16, 18:8, 19:24, 20:8, 21:64, 22:32, 23:24 (AS), 24:24 (MS), 25:40, 26:32, 27:64, 28:16, 29:32, 30:16

A test checks that 0..=22 equals the PC d3d12.h layout.

1. Classification. The stream is parsed with both the PC and the console size tables (PC now includes Agility 26 DEPTH_STENCIL2 = 64, 27 RASTERIZER1 = 48, 28 RASTERIZER2 = 48, 29 SERIALIZED_ROOT_SIGNATURE = 24; the console sizes for 25-30 are 40/32/64/16/32/16, so they differ):

  • only the console table parses it (includes any stream with type 23) → console;
  • only the PC table parses it → PC, passed through byte-for-byte (tests cover 26, 27, 28 and 29);
  • both parse it to the same records: types <= 22 only → PC (identical); types <= 24 → decided by the type-24 shader's PSV0 stage (mesh → console MS, amplification → PC AS);
  • anything else → refused with E_INVALIDARG and the type list.

2. Decision for each console subobject 25-30. Each handler copies the payload into the builder and sets bit n of a flags word (+0x450) only when the payload differs from a fixed default. 0x8aa40 turns bits 0-3 into the CreateGraphicsPipelineStateX extended descs 0-3 (the same ones pso_ext.rs models), and the stream code reuses pso_ext's DsExt and Block field tables.

Type Handler Payload Console behaviour Here
25 0x8a540 32 B, ext 0 D3D12XBOX_PIXEL_SHADER_OPTIONS_DESC all-zero leaves bit 0 clear, so it is identical to absent default: dropped (logged as a no-op). Otherwise refused, naming the non-default fields
26 0x8a5f0 24 B, ext 1 DEPTH_STENCIL_OPTIONS (name from the validator strings at 0x252fb0) default = bytes 0-19 zero, bytes 20-21 = 1 (bytes 22-23 not read). Packed by 0xc23c0 into DB_DEPTH_CONTROL / DB_STENCILREFMASK / DB_STENCILREFMASK_BF. Dword +4 is overwritten afterwards by !DepthBoundsTestEnable of the depth-stencil subobject (0x8afe2) default: dropped. STENCILOPVAL 0: INCR_SAT/DECR_SAT/INCR/DECR → KEEP (op table 0x2332d0 maps those four to ADD/SUB_CLAMP/WRAP; the other ops do not use the op value). BACKFACE_ENABLE 0: back-face state = front-face state. Back-face masks that differ from the front ones → PC DEPTH_STENCIL2 when IndependentFrontAndBackStencilRefMaskSupported, otherwise refused. Refused: colour-writes-on-depth bits, non-zero StencilTestRefValueFront/Back, op values > 1
27 0x8a6d0 60 B, ext 2 D3D12XBOX_GRAPHICS_SHADER_LIMITS_DESC CU masks and wave limits (validator 0xa9660) scheduling hint: dropped, logged with that reason
28 0x8a7f0 12 B, ext 3 D3D12XBOX_PIPELINE_TESSELLATION_PARAMETERS_DESC default = {0, 0.0f, 0}; field 0 is passed to the shader-stub generator 0x159a00 default: dropped. Otherwise refused
29 0x8a870 24 B D3D12XBOX_COMPUTE_SHADER_LIMITS_DESC bit 4 is never read on the graphics path; the payload is used only on the compute branch (0x815f0 → 0x150a40, the same packer as CreateDerivedComputePipelineStateX) scheduling hint: dropped, logged
30 0x8ecb0 8 B pointer at +8 stored at builder +0x380, never read by 0x8aa40 proven no-op: dropped, logged

3. Record sizes come from that table (CONSOLE_RECORD_SIZE, CONSOLE_EXT for each payload's offset and length). The RVAs are listed here and in the PR body, not in code.

4. Logging. The raw subobject type list of the first 8 console-numbered PSOs is logged, plus one line per distinct extension decision, with its payload and reason.

5. Tests (cargo test -p d3d12_xs --lib mesh_pso: 14 passed, 0 failed):

  • console table vs PC layout;
  • console AS/MS remap (including a lone MS decided by PSV0);
  • PC passthrough of 26-29 (and AS+MS, MS-only, AS-only);
  • ambiguous and malformed refusal;
  • 25 and 28 default-drop / refuse;
  • 27/29/30 drop with reason;
  • 26: default, op value 0 → KEEP, stencil off, unit op values, backface disable, each refusal, and per-face → DEPTH_STENCIL2 with DEPTH_STENCIL1 bounds kept.

The full d3d12_xs lib run shows 553 passed and 4 failed. The same 4 (alias::msaa_depth_…, placed_offset::uneven_views_…, title_shadow::buffer_then_texture_…, xs_exports::console_fixed_tests) also fail on a clean main here (546/4), so they are environment-dependent and not related to this change.

Not verified in a title yet. In earlier runs of a UE5 title, the only extension sent was 26, with back masks 0xff/0xff (and 0xff/0xf4) and op values 0/0 or 1/1. With this change those PSOs are mapped, or refused if the back masks differ from the front ones on a device without per-face mask support. I have not re-run the title with this build yet.

**@⁠GDAgent** on GitHub · 2026-11-22 19:26 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7084400496) Thanks for the detailed review. Reworked in `49f8ed3` (rebased onto current `main`, `#176` code kept). All evidence is from the console debug UMD `xgs12_10d.dll` 10.0.22000.3160 (RVAs below are for that file). **Where the table comes from.** `D3d12Device2_CreatePipelineState` (`0x8aa40`) runs the stream parser `0x8e100`: a `switch` over types `0..=30` (anything above 30 is rejected) that hands each payload to a builder vtable (`0x1f5070`) and advances by a fixed record size. That size table is now the `CONSOLE_RECORD_SIZE` constant: `0:16, 1-6:24, 7:40, 8:336, 9:8, 10:48, 11:56, 12:24, 13:8, 14:8, 15:40, 16:8, 17:16, 18:8, 19:24, 20:8, 21:64, 22:32, 23:24 (AS), 24:24 (MS), 25:40, 26:32, 27:64, 28:16, 29:32, 30:16` A test checks that `0..=22` equals the PC `d3d12.h` layout. **1. Classification.** The stream is parsed with both the PC and the console size tables (PC now includes Agility `26 DEPTH_STENCIL2 = 64`, `27 RASTERIZER1 = 48`, `28 RASTERIZER2 = 48`, `29 SERIALIZED_ROOT_SIGNATURE = 24`; the console sizes for 25-30 are 40/32/64/16/32/16, so they differ): - only the console table parses it (includes any stream with type 23) → console; - only the PC table parses it → PC, passed through byte-for-byte (tests cover 26, 27, 28 and 29); - both parse it to the same records: types `<= 22` only → PC (identical); types `<= 24` → decided by the type-24 shader's PSV0 stage (mesh → console MS, amplification → PC AS); - anything else → refused with `E_INVALIDARG` and the type list. **2. Decision for each console subobject 25-30.** Each handler copies the payload into the builder and sets bit `n` of a flags word (`+0x450`) only when the payload differs from a fixed default. `0x8aa40` turns bits 0-3 into the `CreateGraphicsPipelineStateX` extended descs 0-3 (the same ones `pso_ext.rs` models), and the stream code reuses `pso_ext`'s `DsExt` and `Block` field tables. | Type | Handler | Payload | Console behaviour | Here | |---|---|---|---|---| | 25 | `0x8a540` | 32 B, ext 0 `D3D12XBOX_PIXEL_SHADER_OPTIONS_DESC` | all-zero leaves bit 0 clear, so it is identical to absent | default: dropped (logged as a no-op). Otherwise refused, naming the non-default fields | | 26 | `0x8a5f0` | 24 B, ext 1 `DEPTH_STENCIL_OPTIONS` (name from the validator strings at `0x252fb0`) | default = bytes 0-19 zero, bytes 20-21 = 1 (bytes 22-23 not read). Packed by `0xc23c0` into `DB_DEPTH_CONTROL` / `DB_STENCILREFMASK` / `DB_STENCILREFMASK_BF`. Dword +4 is overwritten afterwards by `!DepthBoundsTestEnable` of the depth-stencil subobject (`0x8afe2`) | default: dropped. `STENCILOPVAL 0`: `INCR_SAT/DECR_SAT/INCR/DECR` → `KEEP` (op table `0x2332d0` maps those four to `ADD/SUB_CLAMP/WRAP`; the other ops do not use the op value). `BACKFACE_ENABLE 0`: back-face state = front-face state. Back-face masks that differ from the front ones → PC `DEPTH_STENCIL2` when `IndependentFrontAndBackStencilRefMaskSupported`, otherwise refused. Refused: colour-writes-on-depth bits, non-zero `StencilTestRefValueFront/Back`, op values > 1 | | 27 | `0x8a6d0` | 60 B, ext 2 `D3D12XBOX_GRAPHICS_SHADER_LIMITS_DESC` | CU masks and wave limits (validator `0xa9660`) | scheduling hint: dropped, logged with that reason | | 28 | `0x8a7f0` | 12 B, ext 3 `D3D12XBOX_PIPELINE_TESSELLATION_PARAMETERS_DESC` | default = `{0, 0.0f, 0}`; field 0 is passed to the shader-stub generator `0x159a00` | default: dropped. Otherwise refused | | 29 | `0x8a870` | 24 B `D3D12XBOX_COMPUTE_SHADER_LIMITS_DESC` | bit 4 is never read on the graphics path; the payload is used only on the compute branch (`0x815f0` → `0x150a40`, the same packer as `CreateDerivedComputePipelineStateX`) | scheduling hint: dropped, logged | | 30 | `0x8ecb0` | 8 B pointer at +8 | stored at builder `+0x380`, never read by `0x8aa40` | proven no-op: dropped, logged | **3. Record sizes** come from that table (`CONSOLE_RECORD_SIZE`, `CONSOLE_EXT` for each payload's offset and length). The RVAs are listed here and in the PR body, not in code. **4. Logging.** The raw subobject type list of the first 8 console-numbered PSOs is logged, plus one line per distinct extension decision, with its payload and reason. **5. Tests** (`cargo test -p d3d12_xs --lib mesh_pso`: 14 passed, 0 failed): - console table vs PC layout; - console AS/MS remap (including a lone MS decided by PSV0); - PC passthrough of 26-29 (and AS+MS, MS-only, AS-only); - ambiguous and malformed refusal; - 25 and 28 default-drop / refuse; - 27/29/30 drop with reason; - 26: default, op value 0 → KEEP, stencil off, unit op values, backface disable, each refusal, and per-face → `DEPTH_STENCIL2` with `DEPTH_STENCIL1` bounds kept. The full `d3d12_xs` lib run shows 553 passed and 4 failed. The same 4 (`alias::msaa_depth_…`, `placed_offset::uneven_views_…`, `title_shadow::buffer_then_texture_…`, `xs_exports::console_fixed_tests`) also fail on a clean `main` here (546/4), so they are environment-dependent and not related to this change. **Not verified in a title yet.** In earlier runs of a UE5 title, the only extension sent was 26, with back masks `0xff/0xff` (and `0xff/0xf4`) and op values `0/0` or `1/1`. With this change those PSOs are mapped, or refused if the back masks differ from the front ones on a device without per-face mask support. I have not re-run the title with this build yet.
Author
Owner

@⁠GDAgent on GitHub · 2026-11-22 19:35 UTC · original

Title check for 49f8ed3. The UE5 Xbox Series title ran for 180 s on native Windows 11 (not under Proton). The build was this PR's mesh_pso.rs on top of local unrelated ray-tracing work.

  • Every console-numbered PSO had the same subobject list, [20, 0, 12, 13, 14, 1, 5, 2, 8, 21, 16, 10, 15, 17, 9, 19, 26]: legacy VS/GS/PS, DEPTH_STENCIL1 and console 26. No 23/24/25/27-30 were seen.
  • All 5 distinct 26 payloads were mapped with no PC-visible change. In those PSOs stencil is off, or the masks and op values already match PC.
  • No PSO was refused or ambiguous, and the PC driver rejected none.
  • Frame progress was unchanged compared with the previous build.

The stencil-op rewrite and the DEPTH_STENCIL2 path are covered by the unit tests only. This title did not need either of them.

**@⁠GDAgent** on GitHub · 2026-11-22 19:35 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7084522509) Title check for `49f8ed3`. The UE5 Xbox Series title ran for 180 s on native Windows 11 (not under Proton). The build was this PR's `mesh_pso.rs` on top of local unrelated ray-tracing work. - Every console-numbered PSO had the same subobject list, `[20, 0, 12, 13, 14, 1, 5, 2, 8, 21, 16, 10, 15, 17, 9, 19, 26]`: legacy VS/GS/PS, `DEPTH_STENCIL1` and console `26`. No 23/24/25/27-30 were seen. - All 5 distinct `26` payloads were mapped with no PC-visible change. In those PSOs stencil is off, or the masks and op values already match PC. - No PSO was refused or ambiguous, and the PC driver rejected none. - Frame progress was unchanged compared with the previous build. The stencil-op rewrite and the `DEPTH_STENCIL2` path are covered by the unit tests only. This title did not need either of them.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 22:02 UTC · original

Applied in f8e28c9 + 811c96f (merged in 47ee74d) with your authorship kept, thanks. The graphics lead reviewed v3 and approved it against all five conditions. I added a small steward follow-up, 1a45c7d:

  • the decision log lines now cite the xgs12_10d parser and handler RVAs;
  • BLOCKERS entries for the dropped hints 27, 29 and 30;
  • a BLOCKERS note that the 26 stencil-op rewrite is not yet verified on screen.
    d3d12_xs lib tests pass (573/0). It ships in r29 or r30.
**@⁠omonkeyz** on GitHub · 2026-11-22 22:02 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/168#issuecomment-7086506397) Applied in f8e28c9 + 811c96f (merged in 47ee74d) with your authorship kept, thanks. The graphics lead reviewed v3 and approved it against all five conditions. I added a small steward follow-up, 1a45c7d: - the decision log lines now cite the xgs12_10d parser and handler RVAs; - BLOCKERS entries for the dropped hints 27, 29 and 30; - a BLOCKERS note that the 26 stencil-op rewrite is not yet verified on screen. d3d12_xs lib tests pass (573/0). It ships in r29 or r30.

Pull request closed

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