Commit Graph

5744 Commits

Author SHA1 Message Date
70e3acf459 Runtime: a bundle that sets viewports, scissors or render targets, or calls ClearState, fails its Close, as on D3D12
RSSetViewports, RSSetScissorRects, OMSetRenderTargets and ClearState had
no bundle check, so the layer accepted them in a bundle while the PC
runtime fails that bundle's Close (measured on an RTX 4060 Ti and WARP,
no debug layer). They now invalidate the bundle like the other calls a
bundle may not make.

New host-comparison test d3d12_bundle_forbidden: ten calls, each in a
bundle and, as a control, on a direct list, against the PC runtime on
the default adapter and WARP.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 02:53:47 +07:00
c6901b4ce0 docs: hands and feet use the body skin sheets, whose albedo is not in the package (ASSET-229)
Measured on my own 1.0.2.1 package against the catalogs of all 57 TTPF pools
(357,115 textures). The hand and feet materials bind four maps on shaders
210FBC6A and 8D69EDAB; only the two normal maps are in a pool. The six other
slots of each material bind 0x5D7A3A87CC19967D, in no pool either.

The hands share all four keys with bodynipplesgen_fr1_000 (the female upper
body, core_restofworld.rpf); the feet share specular, normal and ORM with
bodygenitalsgen_f*1_008. Those sheets miss their albedo too, while the male
lower body has all four maps. None of the keys appears in another resource of
the archives the reader can open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:53:41 -03:00
867430739a docs: B8G8R8X8 castable-format lists in d3d12_vulkan.md (BUILD-768)
Say that a castable-format list naming the other family lets a view cross
B8G8R8X8 and B8G8R8A8, that the view's format decides the alpha and the
channel order, and that a typed B8G8R8X8 texture with unordered access
and such a list is still refused, where the host accepts it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:53:06 -03:00
9049f56ef9 docs(pt-BR): explain the run-only build for small drives
Sync the Portuguese quickstart with the upstream disk-space guidance and give the stage selection for preparing the runtime without the asset export.
2026-11-22 16:53:03 -03:00
b4a2e05585 progress_dashboard: no file name from outside the repository on the page
scrub() kept the last component of every absolute path, so a failing test line
naming a carved shader in the work folder showed the shader's name. A path
inside the repository now becomes its relative path and any other path becomes
<path>, file name included; URLs and relative paths are left alone.

The corpus test checked components, sources and metrics only, so a name added
to notes (which the page prints) passed. It now checks everything the
collector holds. Both cases were found by JRamos1993 in review; each new check
fails when the old behaviour is put back.
2026-11-22 16:52:03 -03:00
3b99b37ee8 rdna2spirv: f16_in's denormal note says which reads were measured
A local probe on the RTX 5060 Ti (610.88) found that UnpackHalf2x16
loses an f16 denormal only when an SDWA BYTE_1 select produced it,
from an inline constant or a VGPR alike; the same denormal as a
literal or already in a VGPR widens right on main. The code is
unchanged; the docstring, the test comment and the design.md row now
say that instead of "NVIDIA reads denormals as 0".

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:51:03 +01:00
993eedb376 docs: document deferred G-buffer layout and declared output signatures (PROC-146) 2026-11-22 16:51:02 -03:00
712ac27091 feat(world-index): export authored placement and parent map identity
Use the map root reference array to retain entity ordinals across mixed classes and select the ordinary terrain parent map. Keep physical row order and optional metadata for incomplete inputs.

Refs: #3047, #3087
2026-11-22 14:50:56 -05:00
81ee035741 SHADER-579: barrier-round count borrows an LDS word when the LDS is large
Native wave32 barrier rounds counted the invocations not done in %x_buf,
three Workgroup dwords (#930). With a full 32 KiB LDS that made 32,780 B,
12 bytes over the 32,768 B maxComputeSharedMemorySize of the AMD Windows
and Intel drivers, so the SHADER-309 runtime check refused the pipeline.

When the shader uses its LDS and the array plus 12 bytes is over 16,384 B
(the Vulkan minimum), the count now borrows LDS word 0 between rounds:
invocation 0 saves and clears it, the invocations not done add 1, all read
it, invocation 0 restores it, each step behind a workgroup barrier while
no shader code runs. Smaller shaders keep %x_buf and one barrier per round.
A 32 KiB LDS round shader is now exactly 32,768 B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:50:15 +01:00
95ba4d25f7 docs/testing.md: the seven Intel ANV texture-test crashes are a Mesa bug, fixed in 26.3 (TEST-399)
cs_sample_lz_int_d16, ps_sample_implicit_sint, ps_ssharp, ps_tex,
ps_texture_mip0, ps_texture_sample and ps_texture_sample_d16 crash on Intel
GPUs with Mesa ANV on Linux. Each one segfaults while the driver compiles
the shader, in nir_opt_gcm (nir_opt_gcm.c:430, gcm_schedule_early_src): the
phi it schedules has a source an earlier pass freed (garbage SSA pointer,
use_link pointing at itself). The SPIR-V passes spirv-val, NVIDIA and
llvmpipe pass the same tests, and Mesa 26.3.1 and main (bb98606) pass the
whole suite on the same Iris Xe (131/189, 58 skipped) where 26.2.7 fails
these seven (124/189). A Known problems row says so and how to check a
newer Mesa without installing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:50:12 +01:00
794df5ddd5 Label BCPack Outcome column as projected, account for 17/5,167 BC7 refusals, and update design.md TTPF row 2026-11-22 11:48:06 -08:00
ef703acdf5 rdna2spirv: Unsupported, not KeyError, for an image instruction without a VGPR data operand
llvm-mc accepts `off`, an SGPR or a constant where an image_* instruction names
the VGPR range of its result (image_sample off, v[1:2], ...); the translator
raised KeyError('r') when it wrote the result. image_op, image_get_lod and
image_misc now raise Unsupported. A probe of about 60,000 DS, MUBUF, MTBUF,
MIMG, SMEM and FLAT/GLOBAL/SCRATCH operand and modifier variations finds no
other crash.

AI-assisted.
2026-11-22 20:48:03 +01:00
262423974d Require pack membership evidence before a named page boundary 2026-11-22 20:47:42 +01:00
535e8c23c6 docs(world): clarify the identity needed for parent lookup
Refs: #3087
2026-11-22 14:47:31 -05:00
f847748cc7 Merge origin/main (7 pull requests merged on GitHub)
# Conflicts:
#	docs/design.md
#	tools/psin_data.py
2026-11-22 14:46:26 -05:00
48cf8dbafb docs/models.md: native effect records resolve all 18 material hashes; the effect census reproduced
With @jeremygold02's tools/sgd5_effects.py (#3036, 0029eba7) on the same
shaders.rpf: 932 effect records with distinct name hashes, 913 technique
tables, 25,037 techniques and 28,798 passes, and the data.rpf materials'
18 hashes (3,340 slots) each matching exactly one record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:46:12 -03:00
ef2798d79e Translator: declare SignedZeroInfNanPreserve 64 in f64 modules (SHADER-597)
Modules that declare Float64 now also get
OpExecutionMode %main SignedZeroInfNanPreserve 64, so -0, NaN and inf in
native f64 ops no longer rest on driver defaults. Same gating as the
32-bit mode from #664: the index entry lists
shaderSignedZeroInfNanPreserveFloat64 next to Float32, vk_pipeline_check
skips the shader where that property is false, and --no-float-controls
leaves both modes out. Modules without Float64 are unchanged.

Found by @Jolymmiles (issue #3047).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:46:01 +01:00
adefa18b13 tools: ps_oracle.py runs on Linux AMD GPUs (RADV backend)
RADV returns VK_KHR_pipeline_binary data as one binary per stage
(radv_shader_serialize), not the AMD Windows driver's single PAL ELF, so
ps_oracle exited 77 on every Linux AMD GPU. Find the pixel stage, its
code, sizes, num_vgprs/num_sgprs and rsrc1 by values that must agree
(radv_shader_info's size changes between Mesa versions), replace the
code and raise the VGPR counts. GFX10 only (GFX11+ is refused with
"unsupported architecture"); --set stays PAL-only.

Checked on gfx1036 (RADV RAPHAEL_MENDOCINO, Mesa 26.3.1); an RX 9070 XT
(RADV GFX1201) is refused with exit 77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:45:59 +03:00
35a33bb29d Merge remote-tracking branch 'upstream/main' into shader-340-rdna1-denorm
# Conflicts:
#	docs/design.md
2026-11-22 16:45:30 -03:00
7da853cdc5 docs, tests: probe and close row 403 (v_cmp(x) 16-bit op_sel, constants, sdst inactive lanes)
Natively probe and verify 16-bit vector compares (v_cmp and v_cmpx for
f16, u16, i16) across wave32 and wave64 on AMD RDNA2 silicon (gfx1036,
AMD Ryzen 7000 iGPU, driver 26.11.2):
- v_cmp sets 0 for inactive lanes in sdst (s4 in wave32, s[4:5] in wave64).
- v_cmpx kills inactive/failing lanes in EXEC across wave32 and wave64.
- Inline float constants (1.0, -2.0, 0.5, 4.0): op_sel=0 reads f16 in
  low half; op_sel=1 reads +0.0.
- Inline integer constants (1, -1): op_sel=0 reads low half; op_sel=1
  reads high half (0 for 1, 0xFFFF for -1).
- 32-bit literals: op_sel=0 reads [15:0]; op_sel=1 reads [31:16],
  including signed negative high halves in i16.
- SGPR high halves as src0 and src1 with modifiers (neg, abs).
- f16 ordered vs unordered relations on qNaN/sNaN.

Probed with 0 divergences via tools/probe_gfx1036_vcmp16.py.
Expanded tests/semantic/test_vcmp16_opsel.py with full coverage and
spirv-val compliance. Closed row 403 in docs/design.md (TEST-284).
2026-11-22 22:45:27 +03:00
9d0d7a0490 anim_skel_match: the anim.rpf bone tables are joints of the 596/560-bone humanoid skeletons (ASSET-231)
docs/animation.md said the bone names in anim.rpf's four bone-table streams
could not be matched to a skeleton, because the pages carry no model name and
the model manifest no bone names. A skeleton carries its own names, though
(joaat32 at bone record +0x1C, name at +0x30). The new tool reads the names out
of the four streams and every skeleton anim_glb reads in packs.rpf, and counts
matches by joaat32 of the lowercased name.

On the 1.0.2.1 package: all 30 names are joints, all with the same spelling;
only the 596-bone female and 560-bone male humanoid skeletons hold every one
(14,212 skeletons, 199 distinct); the 15-name table is shared by 69 distinct
smaller rigs. animation.md records the counts.
2026-11-22 20:42:04 +01:00
689701b287 docs/design.md: merge duplicated Scalar select and pack contract rows
Unify the duplicated 'Scalar select and pack' topics from lines 330 and 335
left by the round-40 merge:
- Keep a single authoritative row covering s_cmov_b32, s_cmovk_i32, s_cmov_b64,
  and s_pack_ll/lh/hh_b32_b16.
- Drop the duplicated sentence fragments and test lists in line 330.
- Drop the duplicate row at line 335.
- Remove the contradictory '**Not measured on RDNA2.**' suffix.

Validated with tests/test_docs_design_rows.py.
AI-assisted.
2026-11-23 01:11:42 +05:30
471fe229a1 docs/gamedata: document damage, tuning, combat, ped, and world XML families 2026-11-22 16:41:09 -03:00
6a801497ab docs/story.md: the 42 40 rules over story000.rpf
All 7,577 mesh streams parse (6 stop at non-mesh data after the chunks);
positions, faces, normals, tangents, radius and cones hold as in the minigame
archive (counts only); the stored centres match the box centre less often.
2026-11-22 20:41:08 +01:00
961e97c1d9 docs: update embedded shader translation count to 51/52 (PROC-120)
Update docs/embedded_shaders.md §4 and §5 and related references in
docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll
compute shaders now translate and pass spirv-val since #1871
(GFX10_FORMAT_8_UINT) and #1968 (427c1376: global_atomic_fmax/fmin and
buffer_load_ushort) landed.

Only Box16Rehydration remains blocked, awaiting buffer_store_short (#1864).

Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082579530
2026-11-22 20:40:58 +01:00
ad72f4fc30 rdna2spirv: image_get_resinfo returns what RDNA2 returns (2D depth 0, minified layers, 0 past the last level)
Measured on gfx1036 in #2204 (tools/image_query_probe.py): a 2D image's
depth word is 0, a 2D array's layer count is minified to
max(1, layers >> (BASE_LEVEL + level)), and past the last level width,
height and depth are 0. The translator wrote 1, the full layer count, and
queried OpImageQuerySizeLod past the view's levels (undefined).

Gen.resinfo_words now emits the hardware rule: the level is compared
unsigned with the level count, the size query uses level 0 when it is out of
range, and BASE_LEVEL comes from T# word 3 [15:12]. vk_texture_test's
stand-in T# gets BASE_LEVEL 0 to match its level-0 views. cs_resinfo expects
depth 0 and gains level 5 of five.
2026-11-22 20:40:38 +01:00
7cbb0d006f docs: the console allocator's slots past 8 can't be measured from the package
D3D-360. Read statically on a 1.0.2.1 package whose 16 images all match
game/xbox-1.0.2.1.json: none of them is d3d12_xs.dll, which owns the
allocator's vtable. None contains IID_ID3D12CommandAllocator, and no export
takes an allocator: the BVH builder's take a device or a command list, and the
two FidelityFX DLLs export the five ffx* entry points. No shipped module
creates, receives or calls an allocator, so only the game executable could
show a call past slot 8, and the proxy keeps logging and refusing those.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:39:14 +01:00
a9dd291912 Declare dynamic storage image indexing in translated SPIR-V 2026-11-23 05:38:45 +10:00
dc612fdcd9 docs(shader): qualify the absent-lane swizzle result
The hardware runs control EXEC in full waves. The seven-invocation interpreter case instead selects an absent lane. Distinguish those observations so the CPU fixture cannot be mistaken for a measurement on silicon.
2026-11-22 20:38:16 +01:00
ca438076bc feat(tools): inline_scan finds inline command-list writes and whether each checks the cursor limit
The package's DLLs check before every inline write (BVH builder 196/196, FSR 9/9), so a layer that keeps
the cursor at the limit sees every command. Whether the game's executable does the same was open until it is
available; inline_scan answers it in one pass over a dumpbin listing. Baseline in d3d12_command_objects.md,
day-one step in design.md.
2026-11-22 19:37:55 +00:00
40f57cd08b Add a synthetic GPU readback for lighting multiplication 2026-11-22 20:37:19 +01:00
5320c9b389 docs(shader): distinguish unary f64 validation from execution
The semantic interpreter executes the integer frexp paths but rejects the full fixture at OpTypeFloat 64. Describe the source-word assertions and the executed results separately so readers can reproduce each check.
2026-11-22 20:36:02 +01:00
364fdcbd28 gameinput: raw HID reports and raw device I/O through SDL's hidapi (RT-175)
The shim opens each pad's HID device with SDL_hid_* (by SDL's device path, else the one game-pad collection with the
pad's vendor and product id) and reads its report descriptor for every input, output and feature report's id and
size. Such a pad reports GameInputKindRawDeviceReport and GameInputDeviceRawIoEnabled and fills inputReportInfo,
outputReportInfo and featureReportInfo (no item tables). Readings carry the newest raw input report, and
IGameInputReading::GetRawReport returns it as an IGameInputRawDeviceReport. CreateRawDeviceReport,
GetRawDeviceFeature, SetRawDeviceFeature and SendRawDeviceOutput work through the backend; an undeclared id or kind
is E_INVALIDARG, a failed transfer E_FAIL, and a pad without a HID device keeps E_NOTIMPL.

gameinput_abi.h declares IGameInputRawDeviceReport, GameInputRawDeviceReportKind and the three raw report info
structs, checked against Microsoft's v0 header (offsetof for every field, the 12 vtable slots, the IID). Xbox pads on
Windows go through XInput, whose HID interface SDL's hidapi skips, so they have no raw I/O; the log says so.

gameinput_test covers the descriptor parser and the whole path with a fake HID backend (24 checks);
gameinput_probe prints each pad's report tables and newest raw input report. docs/gameinput.md: "Raw HID".
2026-11-22 22:35:50 +03:00
de89b1f0af docs/i18n: sync pt-BR quickstart with README at 16282101 2026-11-22 16:35:35 -03:00
533d5533a6 SHADER-340: measure RDNA1 mad/mac denormal flush and flush before omod 2026-11-22 16:34:15 -03:00
f5907ef65a Merge main (873a952a) into the RT-176 branch 2026-11-22 16:32:48 -03:00
9acdaa1f0e docs: f16 narrowing row covers the bias and the single MODE pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:32:47 +01:00
e7c83353c7 RT-176: Dispatch runs only the batch queued when it starts
Review follow-up. Dispatch took events one at a time from the live
queue, so readings queued during the call (by the poll thread, or by a
callback) were delivered in the same call: with an unlimited quota a busy
queue could keep the title inside Dispatch, and each erase at the front
made a drain O(n^2) under deliver_mu.

Dispatch now swaps out the batch present at entry and walks it in order;
events it leaves (quota spent) go back to the front of the queue, ahead of
newer ones. gameinput_test adds a callback that queues a reading from
inside the call: each Dispatch(UINT64_MAX) runs exactly its starting batch
and returns true (the previous version never returned). The docs say so,
and the dispatcher row's open column reads a dash instead of a blank.
2026-11-22 16:32:10 -03:00
4c3d624bda Merge main into hw-mad-u32-u16 (#2494)
Conflicts:
	docs/design.md
	tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 20:31:52 +01:00
1f439b0b6e docs/design.md: drop merge leftovers in three contract rows
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 19:30:43 +00:00
9d71037cb5 rdna2spirv: widen f16 denormal operands without UnpackHalf2x16
Gen.f16_in widened every f16 VALU operand with GLSL.std.450
UnpackHalf2x16. NVIDIA's reads an f16 denormal as 0 (RTX 5060 Ti,
610.88), so ps_sdwa_f16_const's word y, the denormal 0x0040 times
1024.0, came back 0x0000 instead of 0x1c00 natively and under
--wave64-emulate. RDNA2's f16 MODE keeps denormals.

A half with a zero exponent field is now widened exactly as
sign * mantissa * 2^-24 with integer ops; other halves keep the
UnpackHalf2x16 result. A semantic test runs ps_sdwa_f16_const with a
flushing UnpackHalf2x16 and fails on the old translation.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:30:36 +01:00
15f5b2fbc0 Fix what the round-41 merges broke
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
  SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
  SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
  embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
  LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:30:33 -05:00
22c5f5804e shader: measure RDNA2 v_cvt_f16_f32 output modifiers under RTZ and preserve div:2 underflow sign 2026-11-22 20:29:53 +01:00
99042c3a9f rdna2spirv: s_flbit_i32_b32 and s_flbit_i32 of a lane mask scan the whole wave
The scans read the register as data, which holds only this lane's 0 / ~0, so every lane
got its own answer. They now take the wave's mask word like s_bcnt1 and s_ff1 do.
2026-11-22 14:28:52 -05:00
24418795b8 test: judge the swizzle sources that run in a narrow pixel shader (#618)
ps_bitmask_perm is skipped when a driver runs the wave32 pixel shader narrower
than 32 lanes (#1318), because the "pippi" pattern reads lanes 16-31, which
then do not run and have no defined value. The skip excused the whole test,
including the sources that do run: at 16 lanes wide every lane reads lane ^ 9,
which is inside the running lanes for lanes 0-7, so a wrong word there went
unnoticed on Intel.

The skip now excuses only the sources that are not there. Where the source
lane runs, its word has to be right, so a narrow run is judged instead of
skipped. At 8 lanes wide every "pippi" source is lane 8 or above, nothing can
be judged, and the test still skips.

The translator change this depends on is #2780: a source lane that is not
running reads 0 instead of an undefined value, which is what makes the narrow
run judgeable at all. Until it lands the note in docs/testing.md describes a
behaviour that main does not have yet.

Tested: python -I tests/test_shader_checks.py (70 tests, OK, on main
16282101). No GPU, no game files.

AI-assisted.
2026-11-22 22:28:37 +03:00
afa0cbb288 docs(world): identify the terrain parent-map selector
Verify the stored signed selector against both candidate maps, entity ordinals, proximity and incoming child counts.

Refs: #3087
2026-11-22 14:27:47 -05:00
899e68437d rdna2spirv: ds_add_f32 and ds_add_rtn_f32
Both raised Unsupported. M = M + DATA as binary32 on the LDS dword, as an
OpAtomicCompareExchange loop with an OpFAdd (round to nearest even), exact
under contention. The LDS adder's denormal / NaN behaviour is not
measured; OpFAdd's IEEE sum is what is computed.

tests/semantic/test_lds_add_f32.py checks values, the non-returning form,
offset, ties to even, signed zero, overflow and seeded values against a
once-rounded double sum. docs/design.md row added.
2026-11-22 16:27:25 -03:00
57f5aec0a1 Tests: keep UNORM midpoint clears in WARP-only controls 2026-11-22 15:26:28 -04:00
314517cc0f rdna2spirv: support VOP3 clamp on v_min3/v_max3/v_med3_{f16,i16,u16} (gfx1036 verified) 2026-11-22 22:25:42 +03:00
1b2e8ff3d6 Revert "Merge pull request #2732 from Kam471"
This reverts commit f8175dc501, reversing
changes made to 6e3426d694.
2026-11-22 14:25:31 -05:00