Commit Graph

11 Commits

Author SHA1 Message Date
a330747f23 d3d12_xs: keep the heap-directly-indexed flags on a host that refuses to serialize them 2026-11-24 19:16:06 -03:00
681847c7c3 d3d12_xs_rootsig: accept an all-zero checksum and keep the fail-closed chunk table
b95925cbf (all-zero checksum accepted, as host d3d12.dll does) and c297bb577/5c3487a94 (strict checksum,
fail closed on a malformed chunk table) changed copy_rts0_blob_clear_xbox_flags in parallel. Merge 1e029d6df
kept the strict early checksum from one and the loop from the other, so:

- an all-zero-checksum Xbox blob was rejected before the zero-aware check ran: root_sig_test fails on main
  ("blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum", "shim deserializer
  accepts an all-zero-checksum Xbox blob with the high byte cleared");
- the chunk loop skipped malformed entries instead of failing, dropped the RTS0 version check, and left
  min_chunk_off unused.

The function now has 5c3487a94's fail-closed chunk walk and RTS0 version check, with b95925cbf's rule: an
all-zero checksum is accepted and stays zero after the rewrite; any other checksum must match. The duplicate
total_size and checksum checks inside the loop are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:44:57 -06:00
1e029d6df2 Merge remote-tracking branch 'origin/pr/8959'
# Conflicts:
#	runtime/shims/d3d12_xs_rootsig.cpp
#	runtime/test/root_sig_test.cpp
2026-11-23 17:46:00 -05:00
5c3487a944 d3d12_xs_rootsig: fail closed on any malformed DXBC chunk-table entry 2026-11-23 22:29:35 +01:00
c297bb5770 d3d12_xs_rootsig: validate DXBC container, hash, and RTS0 chunk before rewriting 2026-11-23 22:16:04 +01:00
b95925cbfc d3d12_xs: verify DXBC total_size and incoming checksum before re-signing RTS0 blobs 2026-11-23 20:51:51 +01:00
0544ba9a21 d3d12_xs: rehash the RTS0 blob after clearing the Xbox flag byte
The host root-signature deserializer checks the DXBC container hash, not
the 0x03000000 flag byte: it accepts a flagged blob with a valid hash and
rejects one with a stale hash. The shim cleared the byte in a copy and kept
the old hash, so it turned blobs the host accepts into E_INVALIDARG. It now
recomputes the hash (DXBC's MD5 variant, as vkd3d and Wine) after clearing.
2026-11-22 13:30:09 +05:30
bd7e53f43a Runtime: serialize root signature 1.2 as 1.1 on runtimes that stop at 1.1 (WIN10-ROOTSIG)
The in-box d3d12.dll of Windows 10 (and Windows 11 23H2, #361) serializes
root signatures only up to 1.1: on Windows 10 it rejects even an empty 1.2
description with E_INVALIDARG (#528). #361 made the tests skip there, but the
d3d12_xs serializer still forwarded 1.2 descriptions unchanged, so every 1.2
root signature from the package DLLs or the game failed on those hosts.

- d3d12_xs_rootsig: downgrade_root_signature_1_2_to_1_1 rewrites a 1.2
  description whose static samplers all have Flags == 0 as the same root
  signature in 1.1 (1.2 differs only in D3D12_STATIC_SAMPLER_DESC1::Flags).
- d3d12_xs: probe the host once with an empty 1.2 description; where it
  stops at 1.1, serialize 1.2 as 1.1, or refuse one with sampler flags
  with a log line.
- root_sig_test: the registered shim's 1.2 checks run on every runtime again;
  new checks cover the rewrite field by field, through the registered shim
  and back through the host deserializer, and the refusal.
- root_signature_oracle_test: its 1.2 cases use sampler flags, which have no
  1.1 form, so they print SKIP where the host can't serialize 1.2.
- docs/d3d12_vulkan.md: the measurement and the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:01:11 -08:00
421207afdc Runtime: clear the Xbox flag high byte in the d3d12_xs deserializer
The d3d12_xs shim masked 0x03000000 on a copy before the host serializer but
forwarded D3D12CreateRootSignatureDeserializer blobs unchanged. The host
deserializer rejects a blob whose RTS0 flags carry that high byte (measured
E_INVALIDARG), and docs/d3d12_vulkan.md says the flags "must be masked on a
copy before the host serializer/deserializer".

copy_rts0_blob_clear_xbox_flags walks the DXBC chunk table to the RTS0 chunk,
clears bits 24-31 of its flags on a copy, and the deserializer forwards that
copy when a rewrite is needed. root_sig_test adds test_deserializer: it
tampers a serialized blob with 0x03000000, checks the host rejects it, and
checks the registered shim deserializer clears it and returns flags 0.

AI-assisted (Cline).
2026-11-22 00:36:18 +01:00
b157c6d673 Runtime: clear the Xbox flag high byte for 1.2 root signatures
The d3d12_xs root-signature shim cleared bits 24-31 of
D3D12_ROOT_SIGNATURE_FLAGS for 1.0 and 1.1 but forwarded 1.2 unchanged, so a
1.2 descriptor with the Xbox high flag byte would reach the PC serializer and
fail. Add the 1.2 case with the same clear_high_byte treatment.

d3d12_xs_root_signature_test gains test_version_1_2: it serializes a 1.2
signature with a descriptor table and the IA-input-layout flag, checks the
versioned reflection, compares legacy deserialization against Windows, and
creates the signature on WARP when the feature level allows.

AI-assisted (Cline).
2026-11-22 00:14:05 +01:00
34d2e63c65 Runtime: match the measured Xbox xmem/d3d12_xs ABI
- xmem: XMemVirtualQuery(process, address, out64) fills the known MEMORY_BASIC_INFORMATION prefix and zeroes the rest; the working-set size goes at +8 with a TRUE return; allocator alignment and size-0 behaviour are documented.
- d3d12_xs: copy root-signature descriptors and clear the Xbox high flag byte (0x03000000) before forwarding to the PC serializer; add the legacy serializer; keep the deserializer.
- d3d12_xs: add D3D12XboxCreateDevice, create a PC device and log the 24-word params block. The Xbox ABI proxy is not implemented; measured slot overrides are documented as TODO and logged at runtime.
- test: root_sig_test serializes synthetic flags=0x03000000 descriptors through the PC d3d12.dll, checks the untouched copy is rejected and the cleared copy is accepted, and exercises the registered shim.

Clean-room: implemented from an ABI-facts spec derived from public write-ups; no source from americas-recomp or AnyPS5 was read or copied.
2026-11-21 17:23:05 +00:00