upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/root_signature.cpp
AgeCommit message (Collapse)Author
10 daysMerge main into root-constants-zeroJan Trencansky
main's pack_stage now spills trailing compute parameters into the array behind s[0:1] and refuses an unknown parameter type. Keep both; drop only the zero-value constant refusal, as this branch does. A zero-value constant takes no SGPRs and no spill dwords, and a new case checks the spill offsets around one. The old "32-SGPR budget refuses before the cost limit" comment no longer holds with spilling and goes; main's over-cost case replaces it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 days[integration] Linux/Proton and native Windows: boot through the story load ↵Moriz82
(RT-PROTON-STORY-LOAD) One squashed commit of a fork that was developed on a Linux/Proton machine and tested on two native Windows machines. On all of them the retail 1.0.2.1 package now launches, shows its launch movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its artwork, and enters the world phase. A first world frame is not verified yet. docs/linux_proton.md has the setup, a healthy boot's timeline, the machines and where it stops. Runtime: frames in the title's own window; DirectStorage pinned reads, page-list scatter/gather, BCPack and unshuffle with a locally generated predictor file; pooled, device-local and deferred image backing for streamed and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table that degrades instead of refusing a submission; a descriptor hash finalizer (off until a library carries it); directly indexed heap offsets for compute dispatches and VS/PS/GS draws; title buffer windows outside a fragmented arena; opt-in device-local copies of streamed buffer views; write-fault retries under the tracker lock, shared trackers and write-watched title memory for native Windows; device-loss, compute-input and memory probes. Translator: loop bounds at structured exits, the eight FidelityFX programs that use a packed-dot form the disassembler skips, buffer bounds modes per view kind, a compaction option, the hash finalizer option. Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows boot script, the paired compute translation script. No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted by people on the machines named in docs/linux_proton.md. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
11 daysroot_signature: accept root constants of 0 values, as the host does (D3D-942)Jan Trencansky
pack() and pack_stage() refused a 32-bit-constants parameter with Num32BitValues == 0, so CreateRootSignature failed where host D3D12 answers S_OK (the serializer warns for versions 1.0 and 1.1; both devices create it). Such a parameter now takes no dwords and no cost: it gets no provenance entry in pack(), and in pack_stage() it shares its first SGPR with the next parameter, so every other offset is unchanged. The Vulkan push-constant range is the fixed ShaderUserData block, not per parameter, so no zero-size range is created; the command list already refuses any write past a parameter's constant count. 65 constants stay refused by the 64-dword cost limit. root_signature_test: zero-value constants alone, between other parameters and from a hand-built RTS0 blob (both packers); 64 constants pass the cost limit and are refused only as a spill; 65 by the cost limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysD3D-448: console root-argument layout, measured for compute and used thereVictor Garcia
rt::rootsig::pack_stage() lays a root signature out for one stage the way the console compiler does: root order from the stage base, a table one dword (its 32-bit VA), a root view two, constants one per value, and the first parameter that does not fit refused (the spill array behind s[0:1] is not modelled). Compute (base s4) is measured: on the package's FidelityFX DLL, whose 29 compute containers carry their RTS0 next to the console-compiled program, base plus span equals RSRC2 USER_SGPR in 29 of 29, and root_sig_contract.py --model console finds all 20 translated programs compatible (the s0 model contradicts 7). VS/PS/GS s8 and MS s16 stay a census hypothesis. The compute bind point now uses this layout; graphics keeps pack(), since every stage reads one push-constant block and a mesh shader (s16) and a pixel shader (s8) would collide. A signature carries both layouts; binding it where its layout refused it invalidates the list. Test fixtures follow: the compute GLSL shaders read the new places, and the asm fixtures a D3D12 compute PSO runs are built with LEONIDA_USER_DATA_SHIFT=4 (compute_fixture.py shifts every SGPR and the RSRC2 user count), so the standalone harness keeps using them at s0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysRefuse unknown root parameter types in the SGPR packerCodex
13 daysrootsig::pack: 64-bit sums, so a huge constant count can't wrap past the limitssanuk369
cost and dword_count + dwords were 32-bit. With {Constants 1, Constants 0xFFFFFFFF} both wrap to 0, so the 64-dword cost check and the 32-SGPR check pass and the loop writes past PackResult::dwords[32] (the test binary dies with 0xC0000409). parse_rts0 copies Num32BitValues from a blob unchecked, so a malformed RTS0 reaches this. Both sums are now 64-bit; root_signature_test gets the wrapping case.
13 daysRuntime: RTS0 descriptor ranges read Flags before the table offsetbennymxckz
parse_rts0 read 1.1/1.2 descriptor-range records with Flags and OffsetInDescriptorsFromTableStart swapped (offset at +16, flags at +20). The PC serializer writes D3D12_DESCRIPTOR_RANGE1 order: type, count, base register, space, Flags, then the offset. Both values were discarded, so nothing broke yet, but the descriptor-table layout would have read flags as offsets. DescriptorRange now keeps all six fields; the canonical codec stores them (codec version 2; nothing persists version 1 blobs). The hand-built 1.1 fixture in root_signature_test had the same swap and is corrected; a 1.0 fixture is added, and root_signature_oracle_test checks every range field against the host serializer for 1.0, 1.1 and 1.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 daysRuntime: parse version 1.2 root signatures, and read RTS0 table ranges from ↵Luis Baker
their offset parse_rts0 refused D3D_ROOT_SIGNATURE_VERSION_1_2 blobs. 1.2 is 1.1 plus D3D12_STATIC_SAMPLER_DESC1::Flags: the PC serializer writes RTS0 version 3 with 14-dword static samplers (13 before). The model gains Version::V1_2 and StaticSampler::flags. The canonical codec writes the flags only for 1.2, so 1.0/1.1 encodings are byte-for-byte unchanged. Checking it against the real serializer found an older bug: a descriptor table's payload is {num_ranges, ranges_offset} with the ranges at that offset, but the parser read them inline after the count. Every table came back with a wrong range type and count. The oracle test only covered constants and a CBV, so it never saw it. root_signature_oracle_test now serializes 1.0, 1.1 and 1.2 signatures with a two-range table, a root SRV and two static samplers (1.2 with a UINT border colour, then non-normalized coordinates). Every sampler field, the ranges and the canonical round trip must match. root_signature_test adds hand-built 1.2 and table payloads and their truncation controls. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 daysRework RTS0 parser to offset-table layout; harden oracle testSuarezPM
Per maintainer feedback: the real blob is a DXBC container whose RTS0 chunk starts version, numParameters, parametersOffset, numStaticSamplers, staticSamplersOffset, flags, with parameters as a {type, visibility, offset} table and payloads at their offsets (d3d types follow D3D12_ROOT_PARAMETER_TYPE numbering, not the model's enum order). Also fixes the oracle segfault mechanism: return early when parsing fails instead of indexing an empty model, and bounds every offset addition in size_t so hostile containers cannot wrap the guard into an OOB read. Adds a wild-offset control plus a DXBC-walk test (19 portable checks green under ASan+UBSan).
14 daysParse RTS0 via DXBC chunk walk; fix OOB wrap and FourCC typoSuarezPM
The MS serializer returns a DXBC container, not a bare payload (proven by the CI blob dump starting with DXBC). parse_rts0 now walks the chunk table like input_signature does and decodes the RTS0 payload. Also fixed: 'O' (0x4F) vs '0' (0x30) in the FourCC check, which silently missed every chunk, and u32 arithmetic wrap in the bounds checks (a hostile offset could wrap off+8 past the guard into an OOB read). Adds a hand-built DXBC container test covering the walk path.
14 daysHarden RTS0/oracle path: bound sampler counts, dump blob bytes on parseSuarezPM
The Windows oracle test segfaulted in CI. Most likely cause: an unbounded static-sampler reserve driven by real-blob bytes under a wrong layout hypothesis. Both decoders now refuse absurd sampler counts, and the oracle test prints the blob size plus the first 32 bytes before parsing so the next CI log shows the true D3D12 layout either way.
14 daysFix MSVC build: std::memcpy instead of __builtin_memcpySuarezPM
The 'build' and 'check' jobs failed with C3861 on MSVC 14.52: __builtin_memcpy is GCC/Clang-only. std::memcpy (<cstring>) works everywhere the portable model compiles.
14 daysRoot signature packer + reconciler + hard-fail (fix the least verifiable ↵SuarezPM
part of the layer) AI-assisted (Muse Spark + explorer fleet). Implements docs/d3d12_vulkan.md section 3.5 as code: a portable D3D12 root-signature model (1.0/1.1, no d3d12.h) plus a packer that lays root parameters into the 32 user-SGPR dwords in root-parameter order (constants take N, views/tables take 2, static samplers take none). Anything that does not fit - more than 32 user SGPRs (spill layout unknown) or more than the 64-dword D3D12 cost limit - is refused loudly instead of truncated. tools/root_sig_contract.py reconciles a candidate signature against every shader's user_sgpr_reads from spirv/index.json (const32 vs constant dwords, 64-bit VAs vs view/table pairs, unpaired-hi detection) and exits nonzero on the first contradiction; --cluster shows which read-set shapes the game actually needs. The RTS0 chunk reader is marked hypothesis until the new Windows oracle test (synthetic descs serialized by the real d3d12.dll) confirms the layout; Tier A (model/packer/canonical codec/RTS0 self-consistency/reconciler) runs everywhere with no game data and no GPU. Tested: python -m pytest tests/test_root_sig_contract.py (12 passed); full suite 651 passed, 20 skipped, 1 xfailed; compileall + make_game --help; portable C++ test 17/17 PASS under g++ -Wall -Wextra -Wpedantic -Werror with ASan+UBSan; turing atlas on RTX 2060 SUPER (subgroup 32, mesh/bary/m8/heap true): compute32/ballot64/f16_input/maintenance8 valid, broken_negative correctly invalid. Windows-only Tier B (oracle + MSVC build) runs in CI.