Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0681b9d
cfg_structure / rdna2spirv: unwrap tautological %pc guards in structu…
whoalin1 Nov 24, 2026
53ef382
cfg_structure: document why loop entry keeps cur_pc | {h} in unwrap_k…
whoalin1 Nov 24, 2026
8e5cf5a
fix(rdna2spirv): include END in out_pcs for trailing conditional bran…
whoalin1 Nov 24, 2026
33431d6
fix(wave64_emulate_opt): refuse exec-fold regions containing a traili…
whoalin1 Nov 25, 2026
93d540e
docs: drop the repeated manifest block in character_models, and test …
Nov 23, 2026
34739cf
tests: compare the fence's info string too, so two languages are not …
milas6669 Nov 23, 2026
a759e1e
tools: guard ps_helper_probe.py empty coverage and atomic --json writes
kirigayakazima Nov 25, 2026
abe47df
tools: handle corrupt XBCH zlib, case-insensitive extensions and inde…
kirigayakazima Nov 25, 2026
81e34a5
tools: harden bcpack_tables_bptc.py section validation, bounds and fi…
kirigayakazima Nov 25, 2026
59eadb0
tools: make script_qtable.py --json writes atomic and validate paths …
kirigayakazima Nov 25, 2026
def89c3
tools: make gamedata_sps1.py --json writes atomic, validate paths and…
kirigayakazima Nov 25, 2026
c90092b
d3d12: changed console heap slots are fixed without a time limit by d…
DadaCap Nov 25, 2026
6e85823
gamedata_reader: preserve empty polymorphic objects
cheltyi Nov 25, 2026
71c8683
tools/int_hw_probe: write --json atomically and reject trailing-separ…
kirigayakazima Nov 25, 2026
3a84ae7
tools/ab_control_flow: handle UTF-8-SIG/CRLF inputs, subprocess encod…
kirigayakazima Nov 25, 2026
93a0f21
BUILD-STAGES: report a stage that raises instead of failing silently
thiefyzheng Nov 25, 2026
daf31b8
replay: copies between depth formats that differ go through transfer …
OreoFR Nov 25, 2026
14f04ce
d3d12: stage title textures when the image cannot take host copies
ecox982745 Nov 25, 2026
9e7720c
Merge pull request #1893 from OreoFR/rt-depth-format-copy-staged
aslan2142 Nov 25, 2026
fe15534
Merge pull request #808 from whoalin1/shader-structured-pc-unwrap
aslan2142 Nov 25, 2026
6ade9f2
Merge pull request #1857 from thiefyzheng/fix/build-stages-exception-…
aslan2142 Nov 25, 2026
aeec1dd
Merge pull request #1850 from cheltyi/fix/gamedata-empty-typed-objects
aslan2142 Nov 25, 2026
b0e11f2
Merge pull request #1807 from kirigayakazima/fix/pal-stages-safety
aslan2142 Nov 25, 2026
863c161
Merge pull request #1791 from Ch1mpleo/carry/old-9862
aslan2142 Nov 25, 2026
082ebe4
Merge pull request #1853 from kirigayakazima/fix/ab-control-flow-safety
aslan2142 Nov 25, 2026
a8266e3
Merge pull request #1852 from kirigayakazima/fix/int-hw-probe-safety
aslan2142 Nov 25, 2026
da4ce8c
Merge pull request #1849 from DadaCap/console-fix-no-null
aslan2142 Nov 25, 2026
1f62a9c
Merge pull request #1817 from kirigayakazima/fix/gamedata-sps1-atomic…
aslan2142 Nov 25, 2026
fd33a31
Merge pull request #1815 from kirigayakazima/fix/script-qtable-atomic…
aslan2142 Nov 25, 2026
360c728
Merge pull request #1793 from kirigayakazima/fix/ps-helper-probe-safety
aslan2142 Nov 25, 2026
b9320a1
Merge pull request #1812 from kirigayakazima/fix/bcpack-bptc-safety
aslan2142 Nov 25, 2026
e500e99
d3d12: CPU-fillable placed BC images share a zero image without host …
DadaCap Nov 25, 2026
06ba2eb
d3d12: stage title images when host transfer has no memory type
ecox982745 Nov 25, 2026
2d258c8
d3d12: log the title staging fallback once per Vulkan format
ecox982745 Nov 25, 2026
5c815be
Merge the upstream shared BC image fix into per-format staging
codex Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions docs/d3d12_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,13 @@ What is implemented (all of it testable without the game):
`E_INVALIDARG` for such a render target, since no other format can view its image. Without that format,
render targets are refused as before; depth-stencil and UAV creation are
unsupported for this format.
- A `CopyTextureRegion` of the depth plane between two depth formats with the same depth encoding but not the
same `VkFormat` (`D32_SFLOAT_S8_UINT` and `D32_SFLOAT`, `D16_UNORM_S8_UINT` and `D16_UNORM`,
`D24_UNORM_S8_UINT` and `X8_D24_UNORM_PACK32`) goes image → transfer scratch → image too, depth aspect on both
sides (`vulkan_replay.h`, `depth_format_pair`; `replay_copy_offset_test`). `vkCmdCopyImage` requires
depth/stencil formats to match exactly (`VUID-vkCmdCopyImage-srcImage-01548`), and an NVIDIA driver (RTX 4070
Laptop, 621.40) handed the `D32_SFLOAT_S8_UINT` → `D32_SFLOAT` pair wrote past the end of the `D32_SFLOAT`
image: the world-start `WRITE_INVALID` device loss, with the fault at the first byte after the image.
- reserved resources and `GetResourceTiling` (section 4.2);
- query heaps for occlusion, timestamps and pipeline statistics, and `GetTimestampFrequency` on the queue
(section 4.6);
Expand Down Expand Up @@ -2878,7 +2885,8 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv
the driver's), as on D3D12.
- GPU-writable slot-133 images on a default heap bind memory when replay, presentation or creation of a shader
view first needs their Vulkan image. D3D12 placement and logical attachment views can precede that bind.
A CPU-fillable, typed BC texture can initially sample an immutable zero image of the same format, extent,
A CPU-fillable, typed BC texture (filled by host copies or the staged upload) can initially sample
an immutable zero image of the same format, extent,
layer count and mip count. A CPU upload or explicit GPU command gives the placement private backing and
republishes its existing descriptor keys. The cache holds at most 256 MiB. `LEONIDA_PLACED_IMAGE_DEFER=0`
restores eager binding.
Expand All @@ -2901,11 +2909,15 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv
- Sampled title images can use device-local memory even when Vulkan host image copies require a
host-visible memory type. The runtime queries the same image with and without host-transfer usage.
When only the latter permits plain device-local backing, it detiles the complete image into a reusable
staging buffer and transfers all its mips and layers together. Linear slot-133 placements retain host
copies. On a device without `VK_EXT_host_image_copy` every colour title image, linear placements too, takes the
staged upload: the refresh before a submission has no other way to fill one, and without it the title's textures
stayed zero (a flat green intro movie). An allocation failure retries the original host-copyable image.
`LEONIDA_TITLE_IMAGE_STAGING=0`
staging buffer and transfers all its mips and layers together. Linear slot-133 placements use host
copies when the image supports them.
A CPU-visible, single-sampled colour title image that needs no format conversion uses the staged upload
if the device, format or image usage lacks host-transfer support, or if the host-transfer image has no
compatible memory type. The runtime logs that last case once per Vulkan format. A GTX 1050 Ti on
NVIDIA 582.66 reported it for R8_UNORM, R8G8B8A8_UNORM and BC1_RGBA_UNORM_BLOCK.
[GTX 1050 Ti test results](https://github.com/ubiquitarianism/leonida/pull/1894#issuecomment-7174515492)
When both placements are available, an allocation failure on the staged path retries the original
host-copyable image. `LEONIDA_TITLE_IMAGE_STAGING=0`
restores the original placement policy. With `LEONIDA_MEM_PROBE`, each title image class logs its
Vulkan memory type mask, mask without host transfer, and selected type.
- `WriteToSubresource`/`ReadFromSubresource` (implemented in `d3d12_vulkan_device.cpp`) complete before they
Expand Down
2 changes: 1 addition & 1 deletion docs/design.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions docs/gamedata.md
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,8 @@ bounded by the largest field. The generic conversion follows the parser's own co
- `x/y/z/w` is a vector tuple.
- `content=` is the array body. `short_array`, `float_array` and `float16_array` give number lists;
`vector2_array`, `vec3v_array`, `matrix33` and `matrix34` give tuples.
- `type="Class"` is a polymorphic object `{"$type": ...}`, and `type="NULL"` is `None`.
- `type="Class"` is a polymorphic object `{"$type": ...}`, including an empty object with no fields or text.
Explicit scalar/vector/array/reference conventions and nonempty text keep their values; `type="NULL"` is `None`.
- `ref=` is `{"$ref": ...}`.
- All-`Item` children are a list, or a dict when every one carries `key=`. A repeated tag is a list. A text-only
element is its text. Any other attribute is kept as `"@name"`.
Expand All @@ -1440,11 +1441,13 @@ On the 1.0.2.1 carve of `common.rpf` the run takes about 5 s, with 0 conversion
| arrays | 13,449 |
| lists | 13,465 |
| keyed maps | 526 |
| polymorphic objects | 6,490 (317 `type` classes over 6,903 typed elements) |
| polymorphic objects | 6,663 (317 `type` classes over 6,903 typed elements) |
| `NULL` pointers | 278 |
| references | 924 |
| elements with extra attributes | 5,262 |

The object count includes 173 empty instances across 13 documents (54 types).

The 7 roots missing from the 118 occur only in documents that are not well-formed. Counts only: the JSON that
`--out` writes is the game's data and stays local. `tests/test_gamedata_reader.py` checks every convention,
both dispatch tables, that streaming equals a whole-tree conversion, and the CLI, on synthetic XML.
Expand Down
24 changes: 21 additions & 3 deletions make_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import tempfile
import threading
import time
import traceback
from concurrent.futures import ThreadPoolExecutor

if __name__ == "__main__" and sys.version_info < (3, 12): # before code an older Python can't run
Expand Down Expand Up @@ -2912,6 +2913,20 @@ def fn_pipelines():
"pipelines": fn_pipelines,
}

reported: set[str] = set()

def report_unexpected(name: str, exc: BaseException) -> None:
"""A stage that fails through fail() already printed a diagnostic; one that raises outright did
not. Report the stage and the exception once per stage, so a failure is never silent."""
if isinstance(exc, RuntimeError) and str(exc).startswith("stage exited with "):
return # fail() called sys.exit; its diagnostic already went out
key = f"{name}: {exc!r}"
if key in reported:
return
reported.add(key)
print(f"\nERROR: stage '{name}' failed with an unexpected exception: {exc!r}", file=sys.stderr)
traceback.print_exc(file=sys.stderr)

if not overlap:
order = [s for s in ("shaders", "assets", "runtime", "pipelines") if s in stages]
if not order:
Expand All @@ -2921,7 +2936,8 @@ def fn_pipelines():
try:
_invoke_stage(name, builders[name])
progress.complete(name)
except Exception:
except Exception as exc:
report_unexpected(name, exc)
sys.exit(1)
return

Expand Down Expand Up @@ -2950,7 +2966,8 @@ def wait(name: str) -> bool:
futures[name].result()
progress.complete(name)
return True
except Exception:
except Exception as exc:
report_unexpected(name, exc)
failed = True
return False

Expand All @@ -2968,7 +2985,8 @@ def wait(name: str) -> bool:
try:
fut.result()
progress.complete(name)
except Exception:
except Exception as exc:
report_unexpected(name, exc)
failed = True
ex.shutdown(wait=True)
except KeyboardInterrupt:
Expand Down
2 changes: 1 addition & 1 deletion runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3478,7 +3478,7 @@ if(TARGET Vulkan::Headers)
target_compile_definitions(d3d12_unmapped_vsharp_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX LEONIDA_VULKAN_DEVICE)
target_compile_options(d3d12_unmapped_vsharp_test PRIVATE /W4 /permissive- /utf-8)
add_test(NAME d3d12_unmapped_vsharp COMMAND d3d12_unmapped_vsharp_test)
set_tests_properties(d3d12_unmapped_vsharp PROPERTIES SKIP_RETURN_CODE 77 ENVIRONMENT "LEONIDA_CONSOLE_FIX_US=0")
set_tests_properties(d3d12_unmapped_vsharp PROPERTIES SKIP_RETURN_CODE 77)
add_executable(d3d12_indirect_zero_test test/d3d12_indirect_zero_test.cpp)
target_link_libraries(d3d12_indirect_zero_test PRIVATE gta6rt_d3d12_com d3d12 dxgi)
target_compile_definitions(d3d12_indirect_zero_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
Expand Down
2 changes: 1 addition & 1 deletion runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ ones marked *diagnostic* only add log lines or exist to compare a run with and w
| `LEONIDA_WINDOW` | unset | `WxH` resizes the title's window when the presenter attaches to it. |
| `LEONIDA_PRESENT_DUMP` | unset | *Diagnostic.* `DIR` or `DIR,N` writes every Nth presented frame (60 by default) as a PNG into `DIR` (`src/present_dump.h`). The files are pictures of the title: keep them out of commits, issues and pull requests. |
| `LEONIDA_LOCAL_SPEECH` | unset | `1` forwards the title's speech-synthesis calls to the host's installed `xgameruntime.dll` where there is one. Unset, and wherever that library is missing, the silent voice answers. No profile sets it. |
| `LEONIDA_CONSOLE_FIX_US` | `4000` | Microseconds one submission may spend fixing the changed slots of a console descriptor heap's copy. Past it, each further changed slot is written as a null descriptor and queued for `LEONIDA_CONSOLE_RETRY_US`, so a shader reads it as empty until its turn comes. `0` removes the limit. |
| `LEONIDA_CONSOLE_FIX_US` | `0` | Microseconds one submission may spend fixing the changed slots of a console descriptor heap's copy; `0` sets no limit. Past it, each further changed slot is written as a null descriptor and queued for `LEONIDA_CONSOLE_RETRY_US`, so a shader reads it as empty until its turn comes: a limit changes results, and can hang the GPU. |
| `LEONIDA_CONSOLE_RETRY_US` | `500` | Microseconds one submission may spend retrying, round robin, the console heap slots not settled yet (a T# whose texture does not exist yet, or one deferred by `LEONIDA_CONSOLE_FIX_US`). `0` retries all of them at every submission. |
| `LEONIDA_SHADOW_ALIAS_MS` | `0` | The shortest time, in milliseconds, between two copies of the title-memory pages that XMem maps at two addresses (no write guard can watch them) into the slot-133 shadows and title windows. `0` copies them at every submission; a larger value lets a GPU read of them be up to that many milliseconds behind the title's writes. |
| `LEONIDA_REFRESH_PER_FRAME` | `0` | Trades correctness for speed. `1`: the slot-133 shadows, title windows and geometry copies are brought up to date only by the first submission after each present, not by every submission; `2`: the console descriptor heaps too. A GPU read of them can then be a frame behind the title's writes (wrong pixels). `0` refreshes all of them at every submission. |
Expand Down
Loading