Commit Graph

5744 Commits

Author SHA1 Message Date
6f58bd2c56 gamedata_index: a --json/--csv path cannot be a carved stream (EGEN-GAMEDATA-STREAM-OVERWRITE) (#6753)
Squash-merged after diff review of PR #6753
2026-11-23 10:47:18 -06:00
86cd0c5f2a d3d12: draw the console's rectangle lists (17, PSO type 19) and quad lists (19) as triangles
A rectangle list is three corners; the fourth is v2 + v3 - v1 for the position and every interpolant, after the vertex stage. A quad list is four vertices per quad. Vulkan has neither. A PSO with topology type 19 was refused (E_INVALIDARG) and the two list topologies drew as a plain triangle list.

Rectangle list: the PSO becomes a triangle-list pipeline with a generated geometry stage (src/rect_list_geometry.h), built from the vertex shader's own SPIR-V outputs, that emits the strip v1 v2 v3 v4. Quad list: one triangle fan per quad (0 1 2, 0 2 3), drawn with the index values 4q..4q+3 so the translated vertex id (VertexIndex - BaseVertex) is right; non-indexed draws read a shared 0, 1, 2, ... buffer reserved in the arena.

Facts from xvalkyrie (GPL-3.0, commit 53af7df77c10); no code copied.
2026-11-23 17:45:10 +01:00
61e8587457 Merge remote-tracking branch 'upstream/main' into rebase/6582-on-042c5f378
# Conflicts:
#	docs/runtime_imports.md
2026-11-23 17:44:12 +01:00
86a7807dd4 Barycentric fallback on by itself on AMD's Windows driver for gfx90c (#5933) (#6828)
Squash-merged after diff review of PR #6828
2026-11-23 10:42:42 -06:00
67950a8d51 d3d12: A8_UNORM render targets through VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5)
The retail title's first native pipelines name an A8_UNORM render target
(@KkelebekK's RT-5 measurements). The layer stored every A8_UNORM texture as
R8_UNORM with a swizzled SRV and refused render targets.

Where the GPU has VK_KHR_maintenance5 and can sample VK_FORMAT_A8_UNORM_KHR and
blend it as a colour attachment, gta6rt enables the extension and its feature
(VulkanDeviceInfo::a8_render_target), and an A8_UNORM texture created with
ALLOW_RENDER_TARGET is stored in that format:
- its RTVs and the PSO's RTVFormats use it, so draws, blends and clears write
  the alpha channel (the clear quantizes alpha like the other UNORM formats);
- its SRVs view the image in the same format. Vulkan puts A8 in a compatibility
  class of its own, so it cannot share an image with an R8 view: gfx10's format
  table gains an 8_UNORM row for it whose one channel X is alpha (channels_a),
  and the T#'s (0, 0, 0, X) becomes (ZERO, ZERO, ZERO, A) on that view;
- CheckFeatureSupport adds RENDER_TARGET and BLENDABLE for A8_UNORM;
- the copy paths know its one-byte texel.
Other A8_UNORM textures stay R8_UNORM, and devices without the format refuse
A8 render targets as before. Depth-stencil and UAV stay refused.

Tests (both on an RTX 3060 and an Intel UHD 750, with Vulkan validation):
- d3d12_clear_formats: A8_UNORM joins the WARP comparison (was "not exposed");
- d3d12_descriptor_test: format support and creation follow the device; an A8
  render target's default and remapped SRVs sample like the R8-backed ones;
- d3d12_draw_test: a full-screen draw and two alpha blends into an A8 target;
- gfx10_descriptors_test: the A8 row and its view mapping.
vk_test_device.h enables maintenance5 like gta6rt, so the whole suite runs
with it: ctest gives the same failures as main on both GPUs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 17:42:36 +01:00
042c5f3783 xmem: physical pages, default allocators, XMemIsToolsMemAvailable; XMemVirtualAlloc takes 2 MiB pages and placeholders (#6919)
Squash-merged after diff review of PR #6919
2026-11-23 10:40:07 -06:00
d3a1c290b5 d3d12: persist the pipeline cache across launches (D3D-704)
PSOs a session built were compiled again by the next one. The layer already read the `pipelines` stage's
pipeline_cache.bin beside gta6rt.exe (#367), but never wrote anything back.

Now the runtime keeps its own cache in pipeline_cache.session.bin beside it: vkGetPipelineCacheData on device
teardown, then vkMergePipelineCaches into the cache at the next launch. Vulkan takes one blob per create, so the
offline seed and the session file are two caches merged together rather than one file. They are deliberately
separate files, so a run can never replace the multi-GB corpus cache with the handful of pipelines it compiled.

The write is capped at 256 MiB (LEONIDA_PIPELINE_CACHE_BYTES=<bytes>, 0 turns it off): a cache seeded from the
corpus comes back as the whole union, which is not worth rewriting at every exit; past the cap the previous
session file is left alone. A foreign or truncated session file is ignored with one line, and so is a failed
write (a read-only install directory).

The header check moves to runtime/src/pipeline_cache_store.h, shared with the offline seed and tested without
Vulkan (runtime/test/pipeline_cache_store_test.cpp: the limit parser and the 32-byte
VkPipelineCacheHeaderVersionOne comparison). write_pipeline_cache_file moves from runtime/test to runtime/src so
the runtime and vk_pipeline_check use the same staged write.

Not run: this machine has neither MSVC nor the Windows SDK, so the shim itself is compiled by the Windows job.
The portable test passes here (23/23 ctest on Linux). The end-to-end check needs a Vulkan GPU: run
d3d12_vulkan_device_test twice and look for "wrote N bytes to pipeline_cache.session.bin", then "merged N bytes"
on the second run.
2026-11-23 17:39:38 +01:00
15a686db31 docs: mark the d3d12_vulkan.md and modding.md notes the executable checklist was missing (#5288)
Squash-merged after diff review of PR #5288
2026-11-23 10:38:03 -06:00
b4d1ba1794 d3d12: preserve PC descriptor validation in slot 25 2026-11-23 11:37:29 -05:00
5cf3dafe3e runtime: honor mapped executable argv startup modes (#6117)
Squash-merged after diff review of PR #6117
2026-11-23 10:36:08 -06:00
d61755d4d1 d3d12_xs: lease a render target's console tile size, not a larger PC answer (#7240 review)
The title's stop-17 range holds two 3840x2160 RGBA8 targets at 510 SW_64KB_D tiles each.
AMD's Windows driver answers 513 x 64 KiB for that target, so leasing max(PC, console)
overran the range and hit an int3 inside the title's hook (measured by controldebils on
an RX 6900 XT). A listed render-target shape now leases its whole tiles; anything else
leases the PC size. The mock gets a driver bias to reproduce the AMD answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:34:19 -05:00
aeb253754c Merge fast-rtbudget into fast-desc-clean 2026-11-23 17:27:58 +01:00
359390833f d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums 2026-11-23 17:26:57 +01:00
a2efc80b93 d3d12_xs: use 56-byte D3D12_RESOURCE_DESC stride for slot 108 descriptor array 2026-11-23 17:26:35 +01:00
ac843fd2b3 docs: name LEONIDA_D3D12_LISTS in the console ABI doc
test_every_variable_is_named_in_a_document fails when a code-used
environment variable is documented nowhere. The variable is described
in the command-list section where the two list layouts are defined.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 09:24:20 -07:00
08490f05d2 d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path
The d3d12_xs shim's device now hands callers console-shaped command
lists (160-slot vtable, object body at +0x18 with the write cursor
pinned at the record limits, console slots 27-30 recorded not
forwarded, slot map measured to the PC table: 60->58, 61->59,
146->80). Queue layout detection is atomic and device-wide; SignalX
(slot 23/25 by layout) forwards as Signal, PresentX (30/32) reaches
the presentation core, and ambiguous slot 18 serves the timestamp-
frequency getter until the layout is proven.

AllocateUploadMemory (console slot 148) carves a bump arena out of
persistently-mapped UPLOAD-heap buffers; the six root-VA setters and
the IA/SO view setters translate arena pointers to buffer device
addresses in proxy-owned copies. Impossible sizes and non-power-of-
two alignments are refused before any arithmetic that could wrap.

PC-compiled callers opt into real PC-shaped lists with
console_lists=false on create_device_proxy, and PC-compiled guests
with LEONIDA_D3D12_LISTS=pc — the fixture path check_tiny_frame.py
sets, so a guest ClearRenderTargetView at PC slot 48 reaches the
real list. The GPU tests take the flag; unmeasured console slots
stay console-shaped for the title path.

docs/d3d12_xs_console_abi.md records the measured ABI.

Split from #2490 (third of three): fixes the run_tiny_frame failure
the revert reported. AI-assisted. Hardware verification on the
earlier identical code is in #2490's thread (RTX 3060 Ti-5080, RX
7600/9060/9070/7900 XT, Intel UHD, RADV; 177/177). Wine/clang-cl on
the build host: xs_proxy_mock PASS incl. the overflow regression,
queue_proxy child-runner section fails identically on unmodified
main (Wine env), loader_test 86/0 upstream count.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 09:24:20 -07:00
5ac4deaa2c d3d12_xs: fence slot 12 returns the address of a live completed value
The retail executable calls fence slot 12, one past ID3D12Fence1, as
(value, descriptor, flags) and reads the return as a pointer to the
fence's 64-bit completed value: it compares it with ~0 and subtracts the
value it waits for. The proxy refused it with E_NOTIMPL, which the title
then dereferenced.

Each fence now gets a mirror on its first slot 12 call. A wait-thread
callback reads the real fence's completed value into it and re-arms
SetEventOnCompletion(value + 1), so it follows every completion without
another call; slot 12 and the CPU Signal refresh it at once, under a lock.
After device removal it holds ~0 and nothing is re-armed. The release of
the proxy unregisters the wait before the real fence goes. The
descriptor's code pointer is not called.

Tests: xs_proxy_mock_test (mock fences now keep a completed value and
arm one event) and queue_proxy_test (a real queue signal reaches the
mirror).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:23:17 +00:00
72ab7623e2 xs proxy test: 32-byte queue desc for slot 48; docs credit #6954
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 17:19:47 +01:00
40360ccb4f Merge #6964 (slot 26 console form) into fast-rtbudget: slot 26 from #6964, slot 25 return-buffer form kept from #6973 2026-11-23 17:18:32 +01:00
824a17f01a Merge origin/main into fast-rtbudget 2026-11-23 17:17:50 +01:00
ae322dafc5 d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17)
On the console a committed resource's memory is allocated with XMemAlloc, so it goes
through the title's __XMemAllocationHooks__. The retail title budgets its first
full-screen render targets with a per-thread hook that bump-allocates out of a range it
reserved and asserts that less than 2 MiB is left; PC resources never allocated through
the hooks, so the assert always fired. Slots 76 and 127 now allocate the slot-25 size of
each resource through the hooks, held by the resource with SetPrivateDataInterface and
freed when it is destroyed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:16:28 -05:00
80417b9c4e wave64: align emulate barrier prediction for s_flbit, mixed s_cmp_*_u64, and ds_nop
Fixes three --wave64-emulate AssertionError crashes and sync mismatches:
- tools/wave64_emulate_opt.py (_classify_block_body, _insn_may_barrier): recognize s_flbit_i32_b32 and s_flbit_i32 on lane masks, and s_cmp_eq_u64/s_cmp_lg_u64 on mixed mask+data SGPR pairs via _has_any_lane_mask_word().
- tools/rdna2spirv.py (Gen.x_memory_order): treat ds_nop as a no-op matching NOOPS and wave64_emulate_opt._x_memory_order_access().
- tests/semantic/test_wave64_emulate_opt.py: add FindSMsb to run_emulated_workgroup OpExtInst handler.
- tests/semantic/test_wave64_emulate_barriers.py: add unit and 64/128-thread workgroup interpreter regression tests.
- docs/design.md: document the wave64-emulate barrier alignment rules and CPU verification scope.

Verified locally (CPU only, no GPU/spirv-val/llvm-mc):
- python -I tests/semantic/test_wave64_emulate_barriers.py -> 13/13 OK
- python -I tests/semantic/test_wave64_emulate_opt.py -> 22/22 OK
- pytest -q (12 test files) -> 70 passed

# Conflicts:
#	docs/design.md

# Conflicts:
#	docs/design.md
#	tools/wave64_emulate_opt.py

# Conflicts:
#	tools/wave64_emulate_opt.py
2026-11-23 21:13:20 +05:00
28766ea6f8 Merge branch 'pr-7110' into rt5-stop17-title-hook-leases
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/xs_proxy_mock_test.cpp
2026-11-23 11:12:48 -05:00
fc7d1f514d Merge origin/main into test/877b-shader-programs-validation
Conflicts in vk_store_test.cpp and vk_texture_test.cpp: both new includes (vk_validation.h and spirv_capability.h) are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:10:41 +00:00
f8e16608ae Merge origin/main into fuzz/mode-diff
Conflict in docs/design.md: kept main's wording for the three rows and kept the v_ldexp_f16 sentence in the MODE.FP_ROUND row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:10:24 +00:00
dc29ee3471 d3d12_xs: route device slots 86, 101, and 108 to PC Device2/Device5/Device8 2026-11-23 17:10:24 +01:00
4a92a119d6 Merge origin/main into fix/ldexp-f16-mode-rtz
Conflict in docs/design.md: kept main's wording for the three rows and re-added the v_ldexp_f16 sentence to the MODE.FP_ROUND row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:09:44 +00:00
00551ba009 DirectStorage: inflate zlib requests (file and memory sources)
A request with ZlibDecompress alone now reads SourceSize bytes of the file or of memory into a staging buffer,
inflates them with the runtime's RFC 1950 inflater (leonida::zlib_inflate in src/shader_library.h) and copies the
result to Destination only when it is exactly DestinationSize bytes. A failed stream leaves the destination
untouched, and a memory source inside its own destination inflates correctly.

Checks follow DSTORAGE_REQUEST and dstorageerr.h: DestinationSize must be larger than SourceSize with zlib
(E_DSTORAGE_INVALID_DESTINATION_SIZE), a zlib FileOffset must be 16-byte aligned (E_DSTORAGE_INVALID_FILE_OFFSET),
IntermediateSize stays 0 without BCPack. Stream failures map to E_DSTORAGE_ZLIB_BAD_HEADER, _ZLIB_BAD_DATA,
_ZLIB_PARITY_FAIL (Adler-32) and E_DSTORAGE_DECOMPRESSION_ERROR (a result of another size). GetStats counts
the inflates, the pending ones and the decompression errors.

zlib_inflate gains an optional failure reason (header, data, checksum, limit); its existing callers are unchanged.
BCPack, swizzle and physical-page requests still fail with E_NOTIMPL.

dstorage_test: synthetic streams only (Python zlib levels 9 and 1, stored blocks built by the test), from a file
and from memory, with every failure code; shader_library_test checks the new failure reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:06:16 +03:00
4440b6f407 docs/exe_fail_fast.md: bindings at main 829e5ede (#6908, #6792)
XMemVirtualAlloc now takes the attribute word and drops the PAGE_GRAPHICS_*
bits (#6908). It still refuses the 2 MiB page mode (0x20003000), which 4 of
the 14 fatal sites pass; the other 10 reach VirtualAlloc. The 6 calls refused
for 0x4000/0x40000 are not fatal sites. D3D12ConfigureVirtualMemoryX has a
shim returning S_OK (#6792), so it moves from "No binding" to the shims table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:05:41 +00:00
ee93d8ce2a run_gpu_tests, rdna2spirv: support --assembler python, --no-validate, and --disasm-dir (#6676)
Squash-merged after diff review of PR #6676 - run_gpu_tests, rdna2spirv: support --assembler python, --no-validate, and --disasm-dir
2026-11-23 10:05:36 -06:00
c2d7dea381 gamedata_graph: keep scanning after an unsupported XML encoding (#6765)
Squash-merged after diff review of PR #6765 - gamedata_graph: keep scanning after an unsupported XML encoding
2026-11-23 10:05:27 -06:00
4c04c0f4e3 d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41)
The retail title creates five one-argument command signatures with no root
signature at startup (device slot 41, CreateCommandSignature at its PC
position). One has the console argument type 105 and a 12-byte stride, next
to a DISPATCH and a DISPATCH_MESH of 12 bytes. The PC layer refuses the
unknown type, which is stop 19 of the RT-5 boot measurements.

Read statically from the title's call sites (shapes only): the two
ExecuteIndirect sites of that signature pass MaxCommandCount 1 and an offset
into the same argument buffer as the DISPATCH sites. Right before, they set
the same compute state as the DISPATCH path (pipeline, compute root signature,
tables, constants, SRV and UAV); they record on a second command list of the
title's context. So the argument is taken as a D3D12_DISPATCH_ARGUMENTS.

Slot 41 now has its own handler. A description that holds type 105 is copied
with that type replaced by DISPATCH (logged once). Any other description is
forwarded as the same pointer. What the console does differently for type 105
is left open in docs/d3d12_vulkan.md (section 4.9).

xs_proxy_mock_test: a two-argument description (a root constant, then type
105) reaches the PC slot 41 as a copy with DISPATCH, the same stride, count,
root signature, IID and output, and the caller's description is untouched; a
PC description is passed through unchanged. With main's d3d12_xs_device.cpp
the new check fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 17:05:11 +01:00
26fdf4170b file_system: CopyFile2 falls back to CopyFileExW on Wine 9 (RT-237) (#3655)
Squash-merged after diff review of PR #3655
2026-11-23 10:04:42 -06:00
07c9b1aece Merge remote-tracking branch 'origin/main' into exe/import-fail-fast 2026-11-23 16:04:38 +00:00
cc67780893 BUILD-2248: run a synthetic guest scene with persistent output from the development CLI (#6691)
Squash-merged after diff review of PR #6691 - BUILD-2248: run a synthetic guest scene with persistent output from the development CLI
2026-11-23 10:04:30 -06:00
efd37f878c docs/i18n ar+tr: add the missing --pick (and tr's --check --full-check) to the terminal list (#6773)
Squash-merged after diff review of PR #6773 - docs/i18n ar+tr: add the missing --pick (and tr's --check --full-check) to the terminal list
2026-11-23 10:04:14 -06:00
0c46fa16b4 docs/animation: one copy of the SKEL_ naming sentence (EGEN-ANIM-SKEL-DUP) (#6781)
Squash-merged after diff review of PR #6781 - docs/animation: one copy of the SKEL_ naming sentence (EGEN-ANIM-SKEL-DUP)
2026-11-23 10:03:39 -06:00
db77244402 tools/wave_diff.py: CPU-only differential fuzzer for wave and cross-lane ops (wave32 and wave64) (#3592)
Squash-merged after diff review of PR #3592
2026-11-23 10:03:02 -06:00
464887b4f4 BUILD-2389: recommend a bounded drawable export window (#6849)
Squash-merged after diff review of PR #6849 - BUILD-2389: recommend a bounded drawable export window
2026-11-23 10:02:58 -06:00
c25b9f280e world_names: join parent maps across input reports (#6766)
Squash-merged after diff review of PR #6766 - world_names: join parent maps across input reports
2026-11-23 10:02:28 -06:00
ffc24131e5 docs(i18n/ru): find llvm-mc with where.exe, not where (#6703)
Squash-merged after diff review of PR #6703 - docs(i18n/ru): find llvm-mc with where.exe, not where (EGEN-RU-WHEREEXE)
2026-11-23 10:02:12 -06:00
2281e365be docs/i18n/pl-PL: full build needs ~400 GB and the assets stage ~370 GB, not 350/300 (EGEN-PL-QUICKSTART-DISK) (#6711)
Squash-merged after diff review of PR #6711 - docs/i18n/pl-PL: full build needs ~400 GB and the assets stage ~370 GB, not 350/300 (EGEN-PL-QUICKSTART-DISK)
2026-11-23 10:01:27 -06:00
f469596f93 rdna2spirv: guard all image_atomic_* by active lane (#3559)
Squash-merged after diff review of PR #3559
2026-11-23 10:01:21 -06:00
aadccec7f0 docs/design.md: drop the duplicate manifest.py row that still promises --verify (#6716)
Squash-merged after diff review of PR #6716 - docs/design.md: drop the duplicate manifest.py row that still promises --verify (EGEN-DESIGN-MANIFEST-ROW)
2026-11-23 10:01:00 -06:00
5018da0871 docs/character_skeleton: name tools/glb_skinning.py as the skinned GLB validator (#6719)
Squash-merged after diff review of PR #6719 - docs/character_skeleton: name tools/glb_skinning.py, the skinned GLB validator (EGEN-GLBSKINNING-DOC)
2026-11-23 10:00:52 -06:00
a637671a94 mods: a mod.json with a UTF-8 byte-order mark loads; UTF-16 is named; contexts are bounded before the cast (#6724)
Squash-merged after diff review of PR #6724 - mods: a mod.json with a UTF-8 byte-order mark loads; UTF-16 is named; contexts are bounded before the cast
2026-11-23 10:00:38 -06:00
0d73e8b95d Merge origin/main: slot 26 next to the Xbox slot routes
AI-assisted.
2026-11-23 16:59:58 +01:00
4da521de3e xgameruntime: serve XAccessibilityImpl and XLauncherImpl offline (speech synthesis, launcher) (#6810)
Squash-merged after diff review of PR #6810 - xgameruntime: serve XAccessibilityImpl and XLauncherImpl offline (speech synthesis, launcher)
2026-11-23 09:58:41 -06:00
35b4a8e00d d3d12_xs: D3D12ConfigureVirtualMemoryX returns S_OK (RT-5 first call) (#6792)
Squash-merged after diff review of PR #6792 - d3d12_xs: D3D12ConfigureVirtualMemoryX shim (first unimplemented call of the title)
2026-11-23 09:58:30 -06:00
9e996e4c32 docs/design.md: opcode differences between gfx1013 and the gfx1036 oracle (#3517)
Squash-merged after diff review of PR #3517
2026-11-23 09:58:20 -06:00