Commit Graph

266 Commits

Author SHA1 Message Date
d7cbc3e7cb Translator: split a dispatch OpSwitch past SPIR-V's limits into two levels
With --wave64-emulate the two ScreenProbes compute shaders reach ~37k dispatch blocks: one OpSwitch of 74k
words, past the 65,535-word instruction limit (and spirv-val's 16,383-case cap). An outer switch on
pc / 16000 now picks a chunk; each chunk is its own selection construct whose blocks exit to its merge. All
26,503 shaders translate and validate with --wave64-emulate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:22:19 -05:00
dbc785f9e5 Merge pull request #332 from fearkov
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-21 18:09:52 -05:00
273e53c8fc Merge pull request #300 from FreddyxS
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-21 18:09:14 -05:00
6eb245f59d Merge pull request #284 from S1m0ne1997
# Conflicts:
#	docs/d3d12_vulkan.md
#	tools/feature_scan.py
2026-11-21 18:07:59 -05:00
7761916406 Merge pull request #303 from mrb-eel 2026-11-21 18:07:42 -05:00
fcd980d3c4 Merge pull request #325 from dcastell1 2026-11-21 18:07:40 -05:00
77fb672cf2 Merge pull request #312 from Tim Elery
# Conflicts:
#	docs/textures.md
2026-11-21 18:07:40 -05:00
97a76333b9 Merge pull request #336 from bbareth 2026-11-21 18:07:38 -05:00
1d2e9cc5ae Merge pull request #323 from Ayinaki 2026-11-21 18:07:37 -05:00
76d3449434 Merge pull request #321 from Jan Kříž 2026-11-21 18:07:37 -05:00
93953ebd75 Merge pull request #320 from Rayhan Robin 2026-11-21 18:07:37 -05:00
abef7cd401 Merge pull request #308 from NWX10 2026-11-21 18:07:37 -05:00
31e2c12bef Merge pull request #307 from NWX10 2026-11-21 18:07:36 -05:00
a42b1990da Merge pull request #311 from Kam471 2026-11-21 18:07:35 -05:00
c5dc2d0330 shader_carve.py: reject incomplete DXBC parts 2026-11-22 00:04:21 +01:00
10d6d4b876 test(fuzz): differential coverage for the integer and bit VALU family
FUZZ-1: model the integer/bit VALU block in tools/cpu_ref.py and add
those ops to the shader_diff program table: v_add_nc_u32, v_sub_nc_u32,
v_subrev_nc_u32, v_mul_u32_u24, v_mul_i32_i24, v_mul_lo_u32,
v_mul_hi_u32/i32, v_mad_u32_u24/i32_i24, v_min_u32/u32, v_max_i32/u32,
v_bfe_u32/i32, v_bfi_b32, v_alignbit_b32, v_alignbyte_b32, v_perm_b32
and v_med3_i32/u32.

Pinned known-answer tests cover the boundaries: bfe width cut and zero,
perm selector ranges (bytes, sign bits, constants), align shift 0 and
24, signed mul_hi, 24-bit sign extension and mad wraparound.

The generator keeps integer ops away from registers last written by a
float op: Vulkan does not promise a NaN payload and the comparison
accepts both-NaN, so reusing those bits as an integer would compare an
unobservable payload. Unobservable as a float, not as an integer.

Verified CPU-only: 28 cpu_ref tests, 6 shader_diff tests, 423 semantic
tests, and 8000 seeded programs (8 seeds x 1000) with 0 mismatches and
0 skips. GPU confirmation on the 5090 is pending.
2026-11-21 23:57:59 +01:00
1186f99340 Merge updated Leonida GPU runner into class compare fix 2026-11-21 23:57:44 +01:00
eb629d41a8 Decode BVH4 header and node pointer fields
The indexer treated the pre-header wrapper words as the root and labelled the real header fields as counts. Parse the documented XboxBvh4Header fields, decode root node pointers, and document the runtime node and leaf layouts while keeping the dehydrated packed stream open.
2026-11-21 22:55:52 +00:00
9ef27a9059 Translator: s_min_i32 and s_max_i32 leave SCC at 0 on a tie 2026-11-21 18:54:33 -04:00
02c89a380b bink_index.py: one line end per CSV row on stdout; a missing target is an error, not a traceback
The CSV written to stdout (the default output) used csv's "\r\n" on a text stream
that already turns "\n" into the platform line end, so every row ended "\r\r\n" on
Windows and a redirected index read as one blank row after each row. The stdout writer
now uses lineterminator="\n", as awc_manifest.py does; --out files were already right.

A target that does not exist ended in a FileNotFoundError traceback from
os.path.getsize; it now prints an error and exits 2, as awc_manifest.py does.

Tests: a stdout stream that writes "\r\n" like Windows' (so the check also runs on
Linux CI) and the missing-target exit code; both fail without the fix.
2026-11-21 23:54:13 +01:00
fe8cd6bc72 Tools: reject out-of-range --start/--limit in RPF index tools
Adds the #283 argparse validators to anim_index, rbf0_index, restofworld_index and rpf9_carve: --start >= 0, --limit >= 1 (decimal or 0x hex), and --max-inflate >= 1 in restofworld_index. Bad ranges now exit 2 before any scan or output instead of silently scanning everything, less, or nothing. Synthetic CLI tests in all four test files; docs notes for each tool.

New item claimed in #156. AI-assisted (OpenCode).
2026-11-21 16:53:41 -06:00
4d18ef9d62 Merge branch 'main' into fix/rdna2-float-to-int-saturation 2026-11-21 23:51:23 +01:00
b262056ac7 Tools: measure the common.rpf content-set graph
Add gamedata_graph.py, which rebuilds the XML payloads from a carve and measures document -> content-set -> target edges. Include ids are joined only on exact equality; missing ids stay dangling and common:/ is not normalized to $(common)/.

Add synthetic tests for includes, a cycle, reachability, prefix classification, unparsed payloads and output redaction. Add a measured docs page linked from the index.
2026-11-21 22:47:26 +00:00
80fb7f2e41 Textures: add clean-room BCPack decoder (rANS + BC1/BC3/BC4/BC5) 2026-11-21 14:44:27 -08:00
ce1eb6ae85 Merge latest Leonida main into class compare fix 2026-11-21 23:42:07 +01:00
186d8793cd feature_scan: say which DS counter ops the ordered/GWS group includes
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:39:19 +01:00
fafcc4197b Merge pull request #284 from S1m0ne1997
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 17:38:43 -05:00
383156b0f5 Merge pull request #299 from AlxcBTW 2026-11-21 17:38:42 -05:00
30ad4802c4 Merge pull request #298 from AlxcBTW
# Conflicts:
#	docs/design.md
#	tests/test_translate.py
2026-11-21 17:38:35 -05:00
a4e435fac2 Merge pull request #276 from eIBart0 2026-11-21 17:38:33 -05:00
8183bb5610 Merge pull request #272 from LuanFreitas
# Conflicts:
#	docs/design.md
#	tests/test_translate.py
2026-11-21 17:38:33 -05:00
b779cc17e1 Merge pull request #301 from Shuvam Pandey 2026-11-21 17:38:32 -05:00
eaea09434b Merge pull request #274 from SuarezPM 2026-11-21 17:38:31 -05:00
38f17196d3 Merge pull request #282 from Claude
# Conflicts:
#	tools/shader_profile.py
2026-11-21 17:38:22 -05:00
2a283c9b21 Merge pull request #297 from dcastell1 2026-11-21 17:38:21 -05:00
09cee3344b Merge pull request #283 from Diego Casares 2026-11-21 17:38:21 -05:00
af688c6cd4 Merge pull request #271 from nicolas 2026-11-21 17:38:21 -05:00
435c2bc19a Merge pull request #267 from nicolas 2026-11-21 17:38:21 -05:00
0b2f460ad1 Merge pull request #263 from nicolas 2026-11-21 17:38:21 -05:00
6da439da0f Merge pull request #289 from Ayinaki 2026-11-21 17:38:21 -05:00
8cd141e5a3 Merge pull request #305 from Kam471 2026-11-21 17:38:20 -05:00
e8a07da4ff feature_scan: count s_getpc_b64 kept for code-embedded data per stage; d3d12_vulkan.md: answer §8.2 #10, per-stage counts for #14, tiled resources for #18
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:38:02 +01:00
40a7edaef3 world_census: reject --shard-size and --jobs below 1
--shard-size 0 (or a negative size) never finished planning shards: pos
never advanced, so the list grew until memory ran out. --jobs 0 crashed
with a ValueError traceback from ProcessPoolExecutor.

Both flags now take a positive_int, so argparse exits 2 with "must be at
least 1". _expected_shards also raises ValueError for a size below 1, for
callers that skip the CLI.

Tests: the CLI cases run in a subprocess with a timeout, and the planner
case counts additions, so a regression fails instead of hanging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:38:00 +03:00
321635899b Tools: feature_scan.py, a corpus scan for D3D12-layer features (SHADER-16)
Counts, from what the shaders stage leaves in <work>/shaders, the features docs/d3d12_vulkan.md
§8.2 #10 and #14 ask about: the DXIL program kind of every shader (hull, domain, amplification),
the SFI0 D3D_SHADER_REQUIRES_* flags (values from the Windows SDK's d3d12shader.h, among them
WAVE_MMA and SHADING_RATE), output-signature streams other than 0, native v_mfma/v_wmma and
GDS/ordered-count instructions in the disassembly, and uses_code_base per stage from
spirv/index.json. Prints counts only. tests/test_feature_scan.py checks it on a synthetic work
folder (hand-built DXBC parts, listings and index).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:37:43 +01:00
5bc48f20b7 world_names: resolve placement/archetype hashes with 32-bit joaat and Murmur3-64
Measured on Xbox 1.0.2.1:
- archetypeName, map name and parent are lower-cased joaat.
- per-archetype +0x20 and map +0x10 keys are MurmurHash3 x64 128 low 64 (seed 0).
- +0x08 is a per-entity id, not a per-archetype hash.

A 79,738-name local dictionary resolves 5,107/24,105 distinct
archetype hashes (8,263/203,799 entities) in two bounded windows,
all confirmed by the 64-bit key; one 32-bit-only candidate is
rejected. Map names resolve 5/23,535 and parents 1/2,089.

Adds tools/world_names.py, synthetic tests, world_names.md, and
map_name64 to world_index output.
2026-11-21 22:36:32 +00:00
fa8beb755a Translate v_cmpx_class_f32 as an EXEC-only compare 2026-11-21 23:35:42 +01:00
6516dfea46 fix(tools): report clear errors for empty, short and out-of-range input
BUILD-30: anim_index, rbf0_index and restofworld_index now reject an
empty archive with a named error instead of mmap's traceback.
rpf9_carve rejects an empty or shorter-than-header archive and a
--start at or past the file size before it divides by the span.
audio_config exits with a named error when the input has no records
instead of formatting None as a hex id.

The new synthetic test covers every case; the existing tests for the
five tools still pass.
2026-11-21 23:31:48 +01:00
e19df2b0d4 make_game.py: read vulkaninfo's subgroup size per device; vk_subgroup_info.py refuses 32-bit Python
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:31:41 +01:00
b33cfa9e8c pe_inspect.py: report a truncated image instead of stopping the run with struct.error
A file cut off inside the optional header, the export directory, the TLS directory or an import lookup table
raised struct.error. main() catches only PeFormatError and OSError, so a run over several images ended in a
traceback at that file and the rest were never inspected. The optional header's fixed fields are now
length-checked, and inspect() turns any remaining struct.error into PeFormatError, which main() reports as
"not a PE image (...)" before moving on.

The two export loops also ran to NumberOfFunctions / NumberOfNames as read from the file, so a corrupt count
near 2^32 kept a run busy indefinitely. They are now capped at MAX_ENTRIES like the import, thunk and TLS
loops, whose comment already says that is what the cap is for.

Tests: TruncatedImageTest in tests/test_pe_inspect.py (each table cut short, a sweep over cut lengths for
PE32 and PE32+, a CLI run that keeps going after a truncated file, and a 0xFFFFFFFF export count).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:31:03 +03:00
b9552cd924 Translator: convert cube sample coordinates for the 2D-array view
The hardware takes a cube sample's s and t in [1, 2] and its third
coordinate as 8 * slice + face (Mesa ac_nir_lower_tex_coords.c, LLPC
ImageBuilder.cpp). Samples and gathers passed them unchanged to the
6-layer 2D-array view; they now use s - 1, t - 1 and layer
6 * slice + face.

ps_cube_sample checks every pixel on a GPU (vk_texture_test cube), and
test_cube_sample checks the coordinates without one.
2026-11-22 04:15:43 +05:45