Commit Graph

5744 Commits

Author SHA1 Message Date
be9350c3b9 Merge remote-tracking branch 'origin/main' into text-tables-archive-lang
# Conflicts:
#	tools/text_tables.py
2026-11-22 15:05:13 -03:00
e8a23c1afc Retire bindless table generations by timeline instead of waiting for the device (D3D-314)
A flush that grows the table or changes live keys now makes a new generation (table buffers, descriptor set, descriptors rewritten from a CPU shadow) that replay binds, and frees the old one once every submission up to its ticket has completed. No vkDeviceWaitIdle. Adds d3d12_bindless_churn_test and the LEONIDA_BINDLESS_IDLE_WAIT=1 comparison knob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:05:06 +01:00
c226964ea0 d3d12: WriteToSubresource/ReadFromSubresource answer as the host runtime does
d3d12_subresource_copy_test runs the same 117 steps on the Vulkan-backed device
and on the host runtime: textures in write-back and write-combine custom heaps,
a volume, an array, BC1 blocks, a buffer, an upload-heap buffer, a default-heap
texture and a multisampled one; whole and boxed copies, boxes outside, empty,
inverted or cutting a block, subresources past the last, pitches too small or
0, and copies before Map. It records every HRESULT and a hash of the whole
destination of every read, once per copy path (host image copy and staging).
On main 17 steps differed (RTX 3060, driver 610.88); now none do. The host's
rules:

- a box is refused only when its right, bottom or back edge lies past the
  mip's, or it cuts a compressed block; an empty or inverted box that passes
  those checks is S_OK and copies nothing (the layer refused it);
- the row and depth pitches are not checked: rows or slices that overlap are
  copied in order (the layer refused a pitch smaller than a row or slice).

Not compared, and reported as such: null data (the host faults; the layer
still answers E_INVALIDARG), which bytes win when a read's rows overlap (the
driver's copy order, tiled on NVIDIA), and a default-heap texture, which the
host refuses and the layer copies on purpose, as docs/d3d12_vulkan.md says.

d3d12_vulkan_device_test's cpu_copies expected the old refusals for an empty
box and overlapping slices, and now expects S_OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:04:31 +01:00
6d59992116 Translator: smaller f16 narrowing, same bits (SHADER-489)
In nearest-even mode the overflow select already maps infinity to 0x7C00, so
the separate infinity select goes. An f16 add/sub without omod is exact below
2^-14, so that range needs no rounding and no underflow select.

v_add_f16 goes from 47 to 31 SPIR-V instructions after spirv-opt -O, and
v_pk_add_f16 from 90 to 58. Checked equal on all 2^32 f32 inputs and all 2^32
f16 operand pairs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TzVEfVrMSeDj68fhoKtKFN
2026-11-22 19:02:48 +01:00
90c4ea6701 test: GPU fixtures for sub-dword MUBUF loads and GFX10_FORMAT_8_UINT (TEST-510)
The docs/design.md "Sub-dword MUBUF loads and GFX10_FORMAT_8_UINT" row was
CPU-checked only. Two single-thread compute fixtures in run_gpu_tests.py's
dump list now run the translated loads through Vulkan:

cs_buf_load_sub: buffer_load_ubyte/sbyte/ushort/sshort zero- and
sign-extended, the dword-crossing ushort at offset 3, and the RAW end check
by element size (a ubyte at 8 and a ushort at 7 of 8 bytes read 0; a
start-only check would read 0xeefe from the 0xee filler).

cs_buf_fmt8: tbuffer_load_format_x format:[BUF_FMT_8_UINT] at offsets 0..3,
one byte past the end, an INVALID V# format (0), and buffer_load_format_xyzw
with V# format 8_UINT and DST_SEL (X, 0, 1, 1), whose w is integer 1.

Both pass on an RTX 3070 Ti (driver 610.88); the expected words follow the
CPU test's byte table and rules. The row now says so; AMD hardware is still
unmeasured.
2026-11-22 12:02:47 -06:00
3d005ca90a tools: census decoded character models 2026-11-22 18:02:27 +00:00
10e310fcce translator: preserve MUBUF DST_SEL=1 on out-of-bounds typed buffer loads (SHADER-429)
On RDNA2 hardware (gfx1036, 746 native kernels via tools/hw_oracle across wave32
and wave64), out-of-bounds MUBUF buffer_load_format_{x,xy,xyz,xyzw} and
buffer_load_format_d16_{x,xy,xyz,xyzw} skip memory access and decode raw data
channels (DST_SEL 4..7) as 0 while V# DST_SEL still runs: DST_SEL=1 yields
1.0f (0x3F800000, d16 0x3C00) iff V# FORMAT[6:0] is a valid float, normalized,
or scaled code (1..77 ending in _UNORM/_SNORM/_USCALED/_SSCALED/_FLOAT), and
integer 1 (0x00000001, d16 0x0001) for UINT/SINT, INVALID (0), and reserved
codes (78..127). MTBUF tbuffer_load_format_* ignores V# DST_SEL and returns 0
in addressed channels when OOB or V# FORMAT=0.

Remove the post-swizzle in_b clamp in Gen.buffer_load_format and classify
float vs integer DST_SEL=1 from the 7-bit GFX10 format table.

AI-assisted.
2026-11-22 10:00:07 -08:00
86d92e13ad [BUILD-761] Validate SPIR-V file framing before creating modules 2026-11-22 18:59:19 +01:00
74a166602c perf(translator): fold chained scalar ALU constants and propagate to sgpr_imm (SHADER-315)
Multi-step constant calculations on SGPRs occur frequently across RDNA2 shaders
(e.g., computing buffer offsets, table strides, descriptor fields, and control words).
Previously, scalar ALU folding recorded constants only for basic single-step
operations and did not track destination literals back into `self.sgpr_imm`,
preventing downstream instructions within the same basic block from recognizing
chained constant expressions.

- Track folded constants into `self.sgpr_imm` for scalar ALU operations:
  `s_mov_b32`, `s_and_b32`, `s_lshl_b32`, `s_lshr_b32`, `s_mul_i32`, `s_xor_b32`,
  `s_add_u32`, `s_sub_u32`, `s_lshl1..4_add_u32`, `s_bfe_u32/i32`, `s_min/max_u32/i32`,
  `s_andn2/orn2/nand/nor/xnor_b32`, `s_abs_i32`, `s_absdiff_i32`, `s_sext_i32_i8/i16`,
  `s_pack_*_b32_b16`, `s_bfm_b32`.
- Preserve `s_or_b32` non-literal tracking to maintain descriptor runtime fallback
  test conventions in `test_buffer_*.py`.
- Ensure standard SPIR-V lowering opcodes (`OpIAddCarry`, `OpISubBorrow`,
  `OpShiftLeftLogical`, `OpBitwiseAnd`, `OpShiftRightArithmetic`, etc.) continue to be
  emitted for arithmetic instructions so lowering and negative control regression
  tests pass intact while populating `self.sgpr_imm`.
- Allow downstream `s_buffer_load` (SMEM) to statically evaluate bounds on chained
  offset calculations, eliminating branch diamonds (`OpSelectionMerge`,
  `OpBranchConditional`, `OpPhi`) for in-bounds accesses.
- Statically fold `s_bfe` control words and `v_bfe` when constant operands are present.
- Updated `docs/design.md` with the confirmed contract.
- Added comprehensive unit tests in `tests/semantic/test_salu_chained_const_prop.py`.

Tested:
- `python -m compileall -q make_game.py tools tests`: OK
- `python -I make_game.py --help`: OK
- `python -m unittest discover -s tests/semantic`: 1,655/1,655 tests passed
GPU: AMD Radeon RX 7800 XT (driver 24.20.19.05, Vulkan 1.4.359, Windows 11).
AI-assisted. Standard library only; no game content or carved shaders.
2026-11-22 23:59:04 +06:00
7003f7ce32 fix(shader): track both weights exchanged by v_swap_b32
A swapped input can be the first read of a barycentric register, and either operand can replace an interpolation weight. Preserve incoming weights and invalidate copies so a fragment uses the values its program exchanged.
2026-11-22 18:58:42 +01:00
bf9db9feca vertex_types: decode tag 0x21 as the mesh shaders do (octahedral normal, 10-bit or 8-bit by bit 31)
The mesh shaders branch on the sign of the 0x21 word: with bit 31 set they unfold an octahedral normal from
unorm10 x/y in bits 0-9 and 10-19; with it clear, from unorm8 x/y in bytes 0-1. normal_0x21 is that decode,
scored as candidate oct_bit31_10_or_8. Scored by class on sampled blocks, each class matches the face normals
only under its own branch (levels: median 1.00 for both); docs/restofworld.md records the counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:58:12 +00:00
df6864d4b7 docs/testing.md: xwin version and Xvfb for the Wine runtime tests
Two things that stop the documented Linux cross-build and Wine run:
- xwin 0.6.5 cannot lay out SDK 10.0.26100 with the documented command
  ("unable to find x86_64 headers"); 0.10.0 can.
- Without a display, Wine has no graphics driver for Vulkan, so every Vulkan
  test fails with vkCreateInstance -3. Run ctest under xvfb-run, as CI does.
2026-11-22 17:57:59 +00:00
732ae77c70 Measure root signatures against the user SGPR counts the console launched
tools/rootsig_census.py joins the 29 RTS0 signatures in amd_fidelityfx_upscaler_xbox.dll with the USER_SGPR count
each of their compute programs was launched with, under both user-data packing models. The surplus is constant (2
dwords or 4), so the arithmetic alone does not choose between them, but the s4 CS pointer base in the corpus census
does. docs/d3d12_vulkan.md records that as consistent with one dword per table rather than proof.
2026-11-22 17:57:17 +00:00
e14b88fc5c Runtime: reserved resources report AMD's packed tile count (D3D-65 follow-up)
The layer gave the packed tail its tight linear size in whole tiles. AMD's PC
runtime gives it one tile per tile-depth slice it spans: ceil(depth of the
first packed mip / tile depth), so 1 for every 2D layout and a step at each
tile depth for volumes (8x8x32 R8: 1 tile, 8x8x33: 2, 8x8x256: 8), even where
the bytes would fit in fewer (16x16x128 RGBA8: 8 tiles for 3 tiles of data).

Measured on an RX 9070 XT (RDNA4, 32.0.31041.1004) and a Ryzen 7 9800X3D iGPU
(RDNA2, 32.0.21045.5002), identical on both: the rule fits all 83 layouts, the
47 from #868 (where it explains the two deep volumes AMD gave 2 tiles) and 36
new volumes whose tail is deeper than a tile, including tails that start after
standard mips. It matters once sparse textures (D3D-285) reach mip tails.

- src/resource_tiling.h: packed tiles = max(1, tight size, tail depth slices).
- resource_tiling_test: the two deep volumes expect 2, plus the 36 new volumes
  with AMD's values.
- docs/d3d12_vulkan.md 4.2: the rule and the measurement.

AI-assisted (Claude Code).
2026-11-22 12:56:50 -05:00
5b5b69aed3 bvh_builder_test: name the container behind each PSO creation (RT-182)
LEONIDA_BVH_RECORD62=1 now prints the module of each CreateComputePipelineState
call (the file name in the container's ILDN part) and says when a creation passes
a container byte-identical to an earlier one. The constructor makes 53 creations
over 52 containers; the repeat is GetBVHCompactedSize (5,284 bytes = 0x14a4):
creations #47 and #53. The test prints a summary and checks that the repeated
container names the same module both times.

docs/embedded_shaders.md answers the open question and lists the creation order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 18:55:53 +01:00
ec8ec4c9a4 Fix what the round-40 merges broke
- docs: one row per topic again in design.md (59 topics merged sentence by sentence, keeping every
  number) and README.md (the current models/character rows); one Other languages line.
- docs/i18n: the two Spanish quickstarts had been concatenated; keep #1912's, drop #2277's row.
- make_game: the shader fingerprint covers spirv_asm.py and its tables; LF settings write.
- tools: pe_shader_containers, gamedata_maps and anim_rigs use report_paths.same_report_path (BUILD-589);
  stdout guard on five tools; LF text writes in three; user_sgpr_census tolerates an unreachable --json.
- tests: fspx stage fakes write real carve/unpack indexes (c7408a1f); typed f16 stores round toward zero
  (SHADER-358); test_ci_registration's helper is no longer collected as a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:55:07 -05:00
37c29f6c82 Tests: GPU test for the far-branch idiom, and no crash on it without encodings
ps_far_branch runs s_getpc_b64 / s_add_u32|s_sub_u32 / s_addc_u32|s_subb_u32 /
s_setpc_b64: two forward jumps, a sub/subb loop, an add/addc -1 loop and a
conditional far jump, with K derived by hand. fold_far_branches now folds the
idiom only when its instructions have encodings, so a listing without them
gives Unsupported instead of a TypeError.

AI-assisted.
2026-11-22 18:54:57 +01:00
64184fc835 Merge main into sdwa-dword-hi16 (#2187)
Conflicts:
	tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 18:53:24 +01:00
0cb7b7bf41 [BUILD-748] Check mesh workgroup memory before pipeline compilation 2026-11-22 18:52:11 +01:00
54b22c4a67 design.md: cite LLVM VOP2Instructions.td / gfx908 scope for v_dot2c_i32_i16 and v_dot8c_i32_i4 2026-11-22 18:51:43 +01:00
f5a7a903ba character_textures.py: classify material slots and flag garments without albedo
The five slot hashes are the verified character-corpus mapping: diffusetex (0xC8E8C282) is the only albedo, speculartex (0xC6F46E79) is specular/gloss, bumptex (0x1E77BF4C) is the tangent-space normal, speculartex2 (0x739E3D0D) is packed ORM, and materialid (0x8ADB8480) is an ID/palette map. Unrecognised hashes print as unknown 0x... and are never matched by texture name.

Garment shaders d5ed50f4, ea8d09d0 and 39ddb9ca declare no 0xC8E8C282 slot, so a garment material without one is flagged garment-no-albedo instead of treating speculartex as colour. --json/--csv reports reuse gamedata_xml.py's same_report_path guard. Tests use synthetic model JSON only.
2026-11-22 17:51:33 +00:00
e969a5e2a0 feat(shader): sample 2D shadow maps at an explicit mip
A depth comparison can request a nonzero mip independently of its reference and coordinates. Feed that LOD to the comparison sampler and preserve the scalar half or full precision result.
2026-11-22 18:50:46 +01:00
c43291cbe1 Add standalone GFX10 RbPlus 2D tile and detile primitive
D3D-316: copy the validated Python 4KB_S and 64KB_D bit patterns into a bounded, portable helper. Cover padded bijections, round trips, Python known offsets and invalid inputs without a GPU.

AI-assisted.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:49:56 +00:00
e804d20ff5 tools/bvh_match.py: find the drawable geometry a dehydrated BLAS was built from
Reads the leaf signature (triangles per geometry index, a leaf that holds two primitives counting
as two), keeps every (drawable, model) of an `rpf9dump models` manifest whose per-geometry triangle
counts contain it as an ordered subsequence, and checks the survivors with
tools/bvh_geometry_check.py from the model's exported OBJ and the 3x4 at +0x50 of the instance
descriptor. The geometries of the two shaders the BVH leaves out are filtered with --skip-shaders
(those name hashes are game data, so the rule is off unless the user passes them); a drawable whose
shader indices the manifest cannot resolve keeps every geometry and the checks decide.

All the BVH logic stays in Python: the C# side is only the model decoding and the export.

Measured on the ten BLAS of the sample pack against one 1 GiB window of levels.rpf: 1,228 models
exported, 1 to 374 candidates per BLAS from the signature, and exactly one consistent candidate
for each of the ten. The tool prints no drawable names unless --names is given.

The two tools that came with #2205 and #2428 lacked the stdout errors="replace" guard every CLI
tool needs (tests/test_tool_stdout_encoding.py), so this also adds it there; without it that test
fails for both.

Tests are synthetic (tests/test_bvh_match.py, 14 cases): the right geometry is found and verified,
a wrong one, a wrong shader rule and a missing transform are not, geometries are matched inside one
model, and a manifest without per-geometry counts is an input error.
2026-11-22 18:49:29 +01:00
e6ab90d6d4 rpf9dump: export a window of a file, and per-geometry counts in the models manifest
Models and textures no longer open the archive document. The entry list comes from this run's
scan or from the index cache, and every resource is read from its own compression blocks
(tools/rpf9dump/Segments.cs), which mirrors the checks ArchiveReader.ReadResourceData makes. That
makes a raw slice of an archive exportable: a window cut out of levels.rpf has no 9FPR header, so
there was nothing to open before, and the mode simply failed on it.

--start/--length scan one window instead of the whole file. A sub-range is never written to the
index cache, which is keyed by the file rather than by the window; the manifest records
Scan.Start and Scan.Length for it.

The manifest gains MeshTris, MeshModels and MeshGeoms: the per-geometry triangles and the
(model, geometry) pair the decoder puts in each mesh name, in the order of the OBJ's `o` groups.
A dehydrated BLAS leaf stores that pair as its geometry index (docs/bvh.md 4a), so a matching tool
can filter candidates on the manifest instead of reading every OBJ.

Measured: one 1 GiB slice of levels.rpf scans, recovers, decodes and exports 1,228 models in about
2 s. The project builds clean with no warnings; tests/Rpf9DumpDiagnostics covers the segment reader
(compressed and raw blocks, a block past the end, a short block, an entry without blocks) and the
mesh key parsing, and still passes.
2026-11-22 18:49:28 +01:00
8c65a37457 docs: drop two stale duplicate rows from the design contract table (Jolymmiles's finding) 2026-11-22 18:48:58 +01:00
7b5ac4d929 tools/bvh_geometry_check.py: check a rehydration's geometry against what the BLAS stores
Bounds (leaves inside and equal to sceneBounds in the leaf frame), stored box overrides (inside the rehydrated slot and no looser, within 4 float32 ulps), paired leaves sharing an edge in the index buffer (position-free) and the internal box area as a tie-break, from docs/bvh.md §4a. On the 8 local samples the right geometry passes everything and a wrong decode fails. Six synthetic tests.
2026-11-22 18:48:56 +01:00
56c0bc848e progress_dashboard: project logo in the header, sticky filters, theme switch
The page embeds assets/logo.png as a data: URI, so it stays one file that
opens from disk; without the asset it shows no image. The filters, search
and section links stay at the top while scrolling, each status filter shows
its count, and a button clears the filters. Panel metrics are bars with
their ratio, panels without evidence move after the ones with it, and the
latest merges are a table with item tags and authors. A theme button
overrides the system theme (kept in localStorage when it is available);
the treemaps and the trend chart redraw on a theme change. Neutrals carry
a faint tint from the logo; status colours are unchanged.
2026-11-22 14:48:31 -03:00
1e5ac8a233 meshlet_page: meshlet record words +8/+12 are the meshlet's centre (1/16 m steps)
w2 bits 0-11, 12-23 and w3 bits 0-11 are x, y and z as (field - 2047) / 16.
meshlet_centre decodes them; --centres compares them with each meshlet's
vertex-box centre on 42 40 geometry: 49.8% of 427,839 axes in the same
1/16 m step and 71.4% within one over the minigame archive (counts only);
offset 2048, 1/8 m steps or swapped axes fit far worse. docs/story.md records
the rule, the controls, why the 63 30 test saw nothing (default words), and
what of the record is still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:47:18 +01:00
1d9691b4d1 rdna2spirv: implement v_dot2c_i32_i16 and v_dot8c_i32_i4 2026-11-22 18:46:53 +01:00
72bfbc21ef tools: add RDNA2 hardware probe for mixed f32/f16 v_interp reads (SHADER-430) 2026-11-22 18:43:51 +01:00
a78c36ae51 d3d12: acceleration-structure state only on a device that has them
@aguedou-34 measured on #2462 that an integrated Radeon without DXR (OPTIONS5
reports no ray tracing) refuses a UAV buffer created in
RAYTRACING_ACCELERATION_STRUCTURE state, which an RTX accepts. The layer now
accepts that state only where it has acceleration structures (KHR builds, or
the XDXR records with the GPU address arena), for committed, placed and
reserved resources alike, and refuses it elsewhere.

d3d12_vulkan_device_test compares the existing committed case on the device
main builds (no acceleration structures) only with a host without ray
tracing, and two new cases on the standalone device (committed and placed)
only with a host that has it; otherwise they are reported as not comparable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:43:48 +01:00
5d73cd5acd fix(shader): read null as zero in quad-byte SAD operands
Quad-byte SAD can use null for its 64-bit pixel window or packed accumulator. Reading the operand with the shared 64-bit decoder lets these shaders compute the same byte differences as an explicit zero register pair.
2026-11-22 18:42:12 +01:00
4958cb1e72 progress_dashboard: count every pull request merged into main as implemented
With --github the dashboard now reads every pull request into main of the
main repository (--repo, default ItsNotRexed/Leonida) on each run: merged
ones are IMPLEMENTED, open ones PARTIAL, closed-unmerged ones are left out.
They are grouped by the item ID the title names (D3D-, SHADER-, BUILD-, ...).
Two new metrics follow the share of merged pull requests and of item IDs
with a merged pull request, and the page lists the 30 latest merges.

The D3D- items of #313 are checked against the same lists, so a pull
request the table still shows as open but already merged counts as merged,
and one closed without merging no longer keeps the item partial.
2026-11-22 14:42:08 -03:00
90f399e953 Runtime: warn loudly (or fail) when CMake finds no Vulkan headers
Without Vulkan headers everything under if(TARGET Vulkan::Headers) is left
out: the D3D12 COM objects, the Vulkan D3D12 device in gta6rt
(LEONIDA_D3D12=vulkan) and most of ctest. The only output was a STATUS line
naming four test tools, so a build whose VULKAN_SDK never reached CMake ran
45 of 125 tests and reported "100% tests passed".

- runtime/cmake/vulkan_headers_missing.cmake: a WARNING that names what is
  left out and that CMakeCache.txt keeps the failed lookup.
- LEONIDA_REQUIRE_VULKAN=ON turns it into a configure error; both CI
  configures pass it, and scripts/build_runtime.ps1 does when VULKAN_SDK is set.
- tests/test_cmake_vulkan_missing.py runs the module with cmake -P and checks
  that CMakeLists.txt and CI use it; docs/testing.md gets a troubleshooting row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:41:47 +01:00
b58859210d odrp_7a: distinguish standalone 0DRP/0x7a resources from PSIN LRSC records (ASSET-156)
Standalone 0x7a resources place the 80-byte 0DRP+122 header at +0x10 after an 8-byte zero prefix + 0x50000000 page-map pointer, with 0x50000000 virtual table pointers (+0x28 structs, +0x30 enums, +0x38 blocks, +0x40/+0x50 optional) and root_objects at +0x20. PSIN LRSC sections place the same 80-byte frame at LRSC+0x08 without the 16-byte prefix, zero +0x08..+0x0f, store the 1-based root_block at +0x10, fill pointer slots (+0x18..+0x37, +0x40..+0x47) with 0xbb, and store (structs, enums, blocks, 0) at +0x38 matching LSCH, LENM and PSIN+0x08.

Add tools/odrp_7a.py with bounded-memory continuation joining across RPF9 streams, carved directories and single files, synthetic unit/CLI tests in tests/test_odrp_7a.py, and aggregate measurements in docs/restofworld.md (22,235/22,235 complete across nine archives, 0 incomplete).
2026-11-22 09:41:41 -08:00
b43a9dad55 ttpf_mips: 3D SW_4KB_S volumes use AMD's bit order for 2-, 4- and 16-byte elements
VOLUME_PATTERNS_4K rows 1, 2 and 4 and the matching tile extents in
tex_headers._VOLUME_4K_TILE matched no GFX10 pattern in Mesa addrlib. They
now follow GFX10_SW_4K_S3_PATINFO (the RbPlus table is identical, and so is
rpf9-explorer's VolumePatterns): 2-byte tiles are 8x16x16, 4-byte 8x16x8,
16-byte 4x8x8. In the 1.0.2.1 corpus this changes the one R16_FLOAT volume
(ttdb_graphics #901): adjacent-Y voxel differences fall from 0.357 to 0.067 of
the random-pair level, adjacent-Z from 0.029 to 0.007, and the check's 3D
Z-diff from 0.023623 to 0.004238 (29.3x below the 2D control instead of 5.3x).
The two 8-byte volumes are unchanged. New VolumePatternTest pins the table to
addrlib's rows and checks the extents follow from it; it fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:40:50 +00:00
19ee6bd25c tools/salu_diff: add integer SALU ops and gfx1036 RDNA2 follow-up to #1746 (SHADER-137) 2026-11-22 20:38:15 +03:00
e40a746da0 feat(shader): translate immediate half-precision rounding modes
Shaders can select the same nearest-even and toward-zero modes with S_ROUND_MODE as with an explicit write to MODE. Track those changes across instructions so half-precision color conversions see the selected rounding.
2026-11-22 18:37:21 +01:00
29b1ba10d9 Tests: GPU test for 16-bit float v_cmpx compares (all 16 f16 predicates, e32 and e64)
Two pixel tests, ps_vcmpx_f16 (e32) and ps_vcmpx_f16_e64 (swapped operands),
on the operand pairs of ps_vcmp_f16: the EXEC result of each predicate, VCC
kept, and EXEC only ANDed. Words derived by hand in the headers; semantic
fixture and test added.

AI-assisted.
2026-11-22 18:37:20 +01:00
0826542225 docs: the two headerless catalog documents are complete, not tail-only (PROC-127) 2026-11-22 18:36:51 +01:00
bdc05cc840 meshlet_page: decode the 42 40 packed positions; +0x6C is the axis order
Slot 0 (tag 0x42, 8 bytes) is the (8, 16) position form rpf9-explorer's
RageModelDecoder already reads: bias f32x3 at +0x60, axis order at +0x6C,
scale f32x3 at +0x70; a = bits 8-31, b = bits 32-47 << 8 | bits 0-7,
c = bits 48-63. positions_4240 decodes it, the page checks count finite and
within-300 m positions, and --faces counts neighbouring-face agreement
(83.7% within ~25 degrees, 0.26% opposed over the minigame archive's
17.3M shared edges; counts only). The record key mode becomes axis.
docs/story.md gets the independent check and drops the open item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:36:44 +01:00
bc800051c2 restofworld_model_join: join RPF9 model system and graphics pages (ASSET-157)
Add tools/restofworld_model_join.py and synthetic unit tests to join RAGE model system streams (rmcDrawable, pgDictionary<rmcDrawable>, fragType) to their owning graphics streams directly from RPF9 archives or carved directories without the encrypted TOC via the +0x08 datResourceMap page header, 64 KiB multi-page blocking, 16-byte-padded contiguous runs, and cross-page LOD/FVF/meshlet validation.

Across core_restofworld.rpf this joins 924/924 model resources (0 unjoined: 796 drawable dictionaries = 808 child drawables, 75 standalone drawables, 53 fragments = 936 drawables total, 1,239,596 primary-LOD triangles, 1,828,800 all-LOD triangles), accounting for all 924 name-bearing system pages across 926 system streams and all 958 42 40 00 00-start streams plus all 13 mid-stream 42 40 00 00 continuations across 1,020 graphics streams, plus 1/1 drawable dictionary (3 drawables, 2,620 triangles) in story000_restofworld.rpf.
2026-11-22 09:36:33 -08:00
2c43266296 v_div_fixup: pass NaN(S0) through copysign and handle exponent underflow/overflow 2026-11-22 18:36:16 +01:00
9f41bf65f3 gta6rt: WinHTTP offline for mapped images
The package's XCurl.dll and libHttpClient.GDK.dll import 16 WinHTTP functions
(no Winsock) and bound to the host's winhttp.dll, so a mapped title could reach
the network. winhttp.dll is now a module the shims own and all 16 are answered
in-process:

- sessions, connections and requests are local handles; no name lookup, no
  socket;
- WinHttpSendRequest fails with ERROR_WINHTTP_CANNOT_CONNECT; on a
  WINHTTP_FLAG_ASYNC session it returns TRUE and reports
  WINHTTP_CALLBACK_STATUS_REQUEST_ERROR {API_SEND_REQUEST, CANNOT_CONNECT} from
  a thread-pool thread with the request's context (not after the request was
  closed);
- reading a response and WinHttpWriteData fail with
  ERROR_WINHTTP_INCORRECT_HANDLE_STATE; options, timeouts and headers are
  accepted, CONTEXT_VALUE and HANDLE_TYPE can be queried;
- callbacks are inherited by child handles (HANDLE_CREATED), and every handle
  reports HANDLE_CLOSING once, last (reference-counted, so a callback that
  closes its own request is safe);
- WinHttpCrackUrl stays the host's (parsing only, loaded on first use).

Each refused server is logged once. winhttp_offline: 40/40 checks, .invalid
names only, no connection opened.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:35:57 +03:00
bfb41bd88b Translate v_interp_mov_f32 p10/p20 as per-vertex attribute deltas
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:34:46 +00:00
91405337cd rdna2spirv: verify and support v_pack_b32_f16 abs/neg modifiers on RDNA2 (gfx1036) 2026-11-22 20:33:45 +03:00
cde85e21e1 Runtime: stage block-compressed copies one vkCmdCopyImage cannot express
CopyTextureRegion between two block-compressed textures copies whole blocks
on the PC runtime. When a mip edge falls inside a block on one side only (a
4x4 box into a 3x3 mip, a 6x6 mip into a 12x12 one), no single Vulkan extent
is a block multiple or reaches the edge of both images, so the layer refused
the copy with invalid_copy (docs/d3d12_vulkan.md, section 3.2 known gaps).

Such a copy now goes through the transfer scratch that depth <-> colour
copies already use (vulkan_scratch.h): vkCmdCopyImageToBuffer with the
source's own cut extent into whole blocks, then vkCmdCopyBufferToImage with
the destination's. The box fits the source's padded mip, so the scratch
holds every block the destination reads. The staged emit path calls the
destination's copy_layout after the scratch write, so every earlier transfer
write is ordered before the destination's (the write-after-write @Vonsek
found under synchronization validation in the first version of #860).

- d3d12_copy_compare: the 8 BC mixed-mip cases that were printed as known
  differences must now match the host; two more shapes (a source edge inside
  the block, a destination offset to the edge).
- d3d12_state_map_test checks the staged regions on the CPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:32:05 +01:00
cba4626a89 rdna2spirv: implement v_cmp_*_f64 and v_cmpx_*_f64 2026-11-22 14:31:58 -03:00
bc66db1531 docs/models.md: material shader hashes lead to effects, not to draw programs
A material's shader hash (rpf9dump manifest Materials[].Shader) is the joaat of its effect name, and the
carve index names every compute program <effect>:<entry>, so a material reaches its effect and that
effect's RaytracingResolve programs: 3,211 of data.rpf's 3,340 materials (8 of 18 hashes). The 23,619
graphics programs carry no effect name, are not stored grouped by effect, and their 8-hex suffix neither is
a joaat of the name nor matches the effect-named programs' suffixes, so effect -> technique -> VS/PS is not
recoverable from the package (presumably in the executable, RT-5). Measured on a 1.0.2.1 copy, counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:31:56 -03:00