Commit Graph

5744 Commits

Author SHA1 Message Date
422b45cc08 docs: drop the superseded M2 milestone row
The M2 formats-test commit appended a fuller row with the 12-case CPU comparison; the original row above it is outdated.
2026-11-22 19:33:37 +01:00
240180e7aa docs/models.md: effect records in shaders.rpf select a technique pass's mesh and pixel programs
Found by @jeremygold02 in #2519 and reproduced on three records of the same
shaders.rpf. The run-time choice of technique and pass, and a general locator
for effect records, stay open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:33:35 -03:00
fdfbeb19f3 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 15:33:35 -03:00
fffde0c8a5 docs: drop the superseded inline-dispatch observation row
The later review pass added the 0x1d047 call with 0x8020 to the same 0x149ba row; keep that one and remove the older short copy.
2026-11-22 19:33:20 +01:00
53ce204ee6 fix(shader): decode literal words for unary binary64 operations
GFX10 places the separate literal dword above 32 zero bits for a binary64 source. Use the same source interpretation for reciprocal, square root and exponent decomposition so literal and register-pair forms produce the same color.
2026-11-22 19:32:46 +01:00
0f6de9e5f0 docs: flat-input and SHADER-177 rows reflect p10/p20 as PerVertexKHR deltas
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 18:32:40 +00:00
f1e8035314 CI: run the GPU suite on llvmpipe under the barycentric fallback
llvmpipe has no VK_KHR_fragment_shader_barycentric, so the native llvmpipe run skips ps_bary,
ps_uniform_branch and ps_scc_mask32, and nothing in CI drew a pixel shader through the --bary-fallback
geometry shader (tools/bary_fallback_gs.py). A third llvmpipe run sets LEONIDA_BARY_FALLBACK=1 and fails
unless every shader that got a fallback geometry shader passes, not just runs: a run where the fallback
builds no geometry shader, or one of them skips, is an error.

docs/testing.md: list the third run, and correct the f16 tests' line: with the f16 interpolation
fallback (on by itself without the extension) ps_interp_f16_high and ms_f16_pack run under the bary
fallback too, and natively on llvmpipe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:32:22 +00:00
bf38f1f8f7 docs: what the skinned mesh shaders read from slots 6, 8 and 17 of the 42 40 blocks (tags 0x4b / 0x84)
The 363 mesh shaders with a 16_16_16_16_UINT load pick each stream's load from its type (low four bits of
a per-slot descriptor word): slot 6 type 6 as 8_8_8_8_UNORM, else four raw dwords; slot 8 type 5 as
8_8_8_8_UINT, else 16_16_16_16_UINT. 198 of them read slot 17's first 8 bytes as a flag bit and element
index plus three unorm16 coordinates blended trilinearly over the element's eight points. On the data,
slot 17's width follows the influence count (338/338 and 121/121 blocks); the coordinate fit holds in the
few shared elements (39) but those are too few to confirm the reading, and the doc says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:32:13 +00:00
b32059d528 rdna2spirv: implement v_div_fixup_f32 (measured on RDNA2 gfx1036) 2026-11-22 10:31:54 -08:00
f87ad89429 SHADER-520: specialize v_perm_b32 with known selectors 2026-11-22 21:31:27 +03:00
45ec44426c bvh_match: --write stores the matched geometry, and docs/bvh.md says how to rebuild the sample set
The matcher could identify the drawable's geometries but had no way to hand them to tools/bvh_rehydrate.py,
so the recipe §4a implies could not be followed end to end. --write DIR now writes one float3 buffer and one
uint32 index buffer per matched geometry plus an export.json (the instance transform recorded, not applied to
the vertices), which is the shape bvh_rehydrate.py already takes.

docs/bvh.md §7 gains the four steps to rebuild the sample set from the user's own copy - bvh_index, a
levels.rpf window, bvh_match with --write, bvh_rehydrate - with the counts to check them against, and the root
parent-table entry the runtime layout must hold (0xFFFFFFFF, as the GPU builder writes and #2625 validates).
Nothing of the samples enters the repository; the two excluded shader hashes stay with the user.

Checked on the sample pack: --write on one identified sample produced buffers of the same sizes as the earlier
reference export of that BLAS (732/816, 2,736/2,808, 492/576 bytes), and rehydrating them with the recorded
transform gave the declared 18,880 bytes. Synthetic tests: two cases added (the buffers and export.json; nothing
written when no candidate is consistent), 18 in total.
2026-11-22 19:31:23 +01:00
65d58f31e0 rdna2spirv: support VOP3 clamp on v_frexp_mant_f16 and v_ldexp_f16 (gfx1036 verified) 2026-11-22 21:29:45 +03:00
9d621f3025 docs: drop the superseded open-question 16 row
The later row still says the runtime/console side is open; the row above it answers the shader side with the full 26,503-shader scan. One row per question.
2026-11-22 19:29:34 +01:00
bd6e3afa68 boot: fix what the trace review found
docs/boot.md: the 24 device words print only when --trace-d3d12 is off, so
the Q1 row says to run once without it; the D3D12 outcomes come from the
Vulkan backend and LEONIDA_UNIMPLEMENTED does not affect them; the Windows
command sets LEONIDA_D3D12 and writes the traces to %TEMP%; the page cites
the real runtime/README.md headings; refused has its own triage step; the
CheckFeatureSupport and PIX rows say what is actually logged.

tools/boot_trace.py: a method name with spaces no longer drops the line;
the outcome is taken as the last field. refused joins the failure buckets.
Exceptions print their access/address and a C++ throw as such. A file with
no [d3d12-trace] line exits 2 instead of reporting zero calls, a UTF-16 log
is named with the PowerShell fix, and a UTF-8 BOM is stripped. The tests
cover each of those shapes.
2026-11-22 15:29:34 -03:00
0a88c2971a Link the animation reference to its auxiliary-table heading 2026-11-22 19:28:24 +01:00
337f714c06 docs: drop stray duplicate fma_mix result rows
Two rows were appended after the prose with no table header; the same results are already in the table above.
2026-11-22 19:28:12 +01:00
f4aefed5ff docs: drop the duplicated open-question 19 row
The same question and answer were appended twice to the table; keep the first one.
2026-11-22 19:28:11 +01:00
abb55d06ea vertex_types: tag 0x27 is a second tangent frame (2_10_10_10 UNORM, xyz*2-1 along u, w the sign)
The mesh shaders fetch tag 0x27 as BUF_FMT_2_10_10_10_UNORM, map each component by v*2-1, transform xyz
like the normal and cross it with the normal scaled by w. tangent_0x27 is that read, and tangent27_checks
counts per 0x27 slot: unit length, perpendicular to the face normal, along dP/du of each 0x28 stream, and
the side w gives the bitangent. docs/restofworld.md records the counts (levels slot 11: 100% unit, 96.7%
along u of stream 4, w side 99.8%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:25:53 +00:00
31b16baaff docs/design.md: repair the s_bfe past-bit-31 row the round-40 merge garbled
- the row ended up with two Source: paragraphs, a pasted half-sentence
  fragment and "the translator (bfe_width) already did this" three times,
  ending "RDNA2 is not measured" right after the gfx1035/gfx1036
  measurements it lists (PROC-132, found by @CLHelper).
- keep the pre-merge superset row: one Source: with the gfx1150, gfx1201,
  gfx1035 (SHADER-137) and gfx1036 measurements, the constantFoldBFE
  sentence kept, the fragment, the duplicates and the "RDNA2 is not
  measured" tail dropped.
2026-11-22 19:24:32 +01:00
6180a1a976 skinned_glb: accept the packed 0x8c joint layout
Slots 8/9 may store four u32 words per vertex with the joint index in bits 0..11. Convert that to the same 4 x u8 rows as 0x25, rejecting an index above 255 and a stream shorter than 16 bytes per vertex.

Add synthetic coverage for the decode, an out-of-range index and a short stream; document the layout beside 0x25.
2026-11-22 18:24:25 +00:00
2fa39a4f74 fix(shader): preserve texel offsets in packed texture gathers
GFX10 keeps the offset in a separate full-width word before the packed UV and LOD. Accept that address layout so packed gathers can read the same four taps as their full-width counterparts.
2026-11-22 19:24:13 +01:00
55a073183e d3d12: SetName is readable as WKPDID_D3DDebugObjectNameW, with the right GUID
@pwu2775-dev found on #2533 that the tests' WKPDID_D3DDebugObjectNameW was
mistyped ({4cca5fd8-921f-42c8-8599-d2866a3e5f7e}, the layer's old constant)
instead of d3dcommon.h's {4cca5fd8-921f-42c8-8566-70caf2a9b741}. Measured with
the right key, the host runtime does what D3D12 documents: SetName is
SetPrivateData with that key and the name with its terminator, GetPrivateData
reads it back (an empty name is a 2-byte entry), and the narrow key is not
touched. SetName(nullptr) faults in the host and leaves the name as it was.

So the name goes back into the private data, now under the right GUID, and the
separate name_ / debug_name() are gone. SetName(nullptr) answers E_INVALIDARG
and changes nothing. d3d12_private_data_test: 667 steps compared, 0 mismatches
(RTX 3060, driver 610.88); d3d12_debug_markers_test checks the name again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:24:07 +01:00
0e5e539c42 Work around Mesa ANV descriptor index compiler crash 2026-11-22 23:52:48 +05:30
2e5c9a9c43 Merge remote-tracking branch 'origin/main' into queue-wait-before-signal 2026-11-22 19:22:39 +01:00
fbc11e973d D3D12 queues: hold a batch that waits for a Signal not yet submitted, so layouts follow dependency order
A queue's ExecuteCommandLists is replayed against one LayoutTracker in call order, so a batch that waits (cross-queue) for a Signal submitted later was
recorded against layouts from before the work it waits for. Track, per fence, the highest Signal value submitted (CPU Signal and the creation value
count); a queue holds a batch, and what follows it, while a Wait names a higher value, and the thread that submits the satisfying Signal releases the
held work in dependency order on its own VkQueue. Reports a queue destroyed with held work and a fence released under a waiter; nothing blocks.

Adds d3d12_queue_handover_test (27 queue-type assignments x 6 submission orders, two producers, CPU Signal cases, never-signaled and released fences,
byte-exact against the host runtime) and updates docs section 4.4 and the M4 row. Two existing tests that used an unsignaled Wait as a GPU gate or
expected a synchronous submit failure under a pending Wait now declare the Signal first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:22:39 +01:00
0b96b1f0d4 design.md: drop the stale 'Not GPU-verified' from the 16-bit min3/max3/med3 row; name the all-NaN rows
The row says it is hardware-verified (gfx1036, and gfx1035 since) and then
'Not GPU-verified.' from before the measurement. The new all-NaN rows are named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:22:24 +01:00
82bdcb889c tools: census decoded character models 2026-11-22 18:22:18 +00:00
b4827fd398 rootsig_census: read each program beside its signature
--disasm now scans tools/fspx_unpack.py output for the user SGPRs a program reads, the one it zero-extends into an
s_load base and the pairs it copies whole. Over the 29 containers that puts the two tables at s4 and s5 one dword
each and the root CBVs at whole pairs from s6, which is the one-dword-per-table model, so docs/d3d12_vulkan.md states
the mapping instead of calling it merely consistent.
2026-11-22 18:22:15 +00:00
dfde07df6d Docs: describe embedded DXIL reflection parts 2026-11-22 15:21:01 -03:00
bb635b9b43 design.md: the corpus's 172 SDWA forms measured on RDNA2; test with the measured words
Every distinct SDWA form in the 26,503 listings (79,307 instructions) was run
natively on gfx1036 through tools/hw_oracle in the game's MODE, 21,204 cases.
18,885 match the translator. The rest are the 16-bit dst_sel:DWORD high half
(#2187), NaN sign/payload (as in the f16 transcendentals row), div:2 on -0
(the output-modifier rows) and 160 cases undefined in SPIR-V.
test_alu_sdwa_hw.py replays 624 matching words, up to four per form; it
fails when sext() or UNUSED_PRESERVE handling is broken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:20:59 +01:00
39d57fec70 rdna2spirv: implement v_cvt_pknorm_i16_f16 and v_cvt_pknorm_u16_f16 2026-11-22 19:20:56 +01:00
9c36e84cc1 d3d12_vulkan.md: the seventh stale count, in 4.8's list of paths (PROC-120)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:20:38 +01:00
8cb70f81ca tools: link the skinned GLB docs and cover the no-numpy path 2026-11-22 18:20:33 +00:00
dd331fb185 GPU tests: bind the --pc-tail-ubo block, so 128-byte push-constant devices run the tests
With LEONIDA_PC_TAIL_UBO=1, build.py and run_gpu_tests.py translate with --pc-tail-ubo, and the test
programs (vk_compute_test, vk_store_test, vk_harness, vk_texture_test, vk_sampler_test, vk_bindless_test)
declare and push 128 bytes and, when a stage declares set 1, bind the tail block there
(runtime/test/vk_pc_tail.h: a host-visible buffer with one slot per dispatch or draw, bound as a dynamic
uniform buffer). vk_harness refuses --mesh-compute with the flag (exit 77): mesh_compute_vs.py's vertex
shader still reads its address from push constants. Without the variable nothing changes.

Step 2 of the uniform-buffer tail claimed in #1902.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:20:22 +02:00
0d938dedd8 Docs: 51 of the BVH builder's 52 FSSM programs translate on main; one rule (buffer_store_short) left (PROC-120)
Recounted with main 49475796 on the 1.0.2.1 package (counts only): 52/52 unpack,
42 clean and 10 with invalid words in the disassembly, 51 translate and pass
spirv-val. The four rules embedded_shaders.md listed are three since 427c1376
(#1968); Box16Rehydration stops at buffer_store_short (#1864). d3d12_vulkan.md
and the docs index quoted 41/42 and four rules in seven places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:20:09 +01:00
88475899c8 make_game: name a packaged XVC/XVD container instead of "not found"
The store keeps the game as one .xvc file, an XVD container whose contents
are encrypted. Pointed at it with --game, the build said "Game folder not
found"; pointed at a folder holding only that file it said "doesn't look
like a supported version"; --find skipped it silently.

Read the plain 4 KiB header (msft-xvd magic at 0x200, VolumeFlags,
ContentType, XvcDataLength, PackageVersion) and say what the file is and
that the build needs the folder holding MicrosoftGame.Config. Nothing is
decrypted and no key field is read. --find lists such files as "not
usable"; the not-found message, the pasted-folder prompt and --pick's
warning name the containers they saw.
2026-11-22 15:19:44 -03:00
50417e26c4 docs: d3d12_vulkan.md open questions list rows 16, 19 and 20 once, in order (PROC-129)
Merge rounds left rows 16, 19 and 20 of section 8.2 twice and row 10 after
13. Row 16 keeps the shader answer (feature_scan over the corpus) and the
runtime-side status; row 19's copies were identical; row 20 keeps both
counts (52 containers with FSSM and Xbox DXIL, the 53 compute PSO
creations bvh_builder_test sees), both questions (a reference match, the 31
raw-address shaders) and both methods. Row 10 moves back between 9 and 11.
2026-11-22 12:19:09 -06:00
9d5a474ec3 Merge main into shader-363-pknorm-single-rounding: keep the single updated v_cvt_pknorm row in the deduped table 2026-11-22 21:18:36 +03:00
79d92bb409 PROC-129: merge duplicate rows in the open-questions table
Rows 16, 19 and 20 appeared twice with partially different text; keep every
fact in one row each. Row 10 sat after row 13; put it back in numeric order.

No game data, no code or test behaviour change.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-22 19:18:15 +01:00
df1ae87efe runtime: buffer_at finds a buffer by binary search, not a scan of every resource
VulkanContext::buffer_at walked every registered resource, images included,
for each vertex-buffer slot, index buffer and WriteBufferImmediate of every
draw. It now asks a BufferVaIndex of the addressable buffers (no image, a
VkBuffer, a VA and bytes: what the scan accepted), kept in step with
resources_ by add_resource, add_sparse_buffer and remove_resource; a
re-registered ID drops its old range first.

Where placed buffers alias, the scan returned whichever matched first in
unordered_map order; the index returns the range that starts closest below
the VA. docs/d3d12_vulkan.md drops the "Lookups" known gap.
2026-11-22 19:17:52 +01:00
4102dcfd08 Merge pull request #2745 from Vonsek 2026-11-22 13:17:30 -05:00
3a44e1926b Merge pull request #2736 from mrp1no 2026-11-22 13:17:27 -05:00
f8175dc501 Merge pull request #2732 from Kam471 2026-11-22 13:17:25 -05:00
6e3426d694 Merge pull request #2731 from tibzejoker 2026-11-22 13:17:25 -05:00
0963784063 PresentX planes: filter and blend in linear light, selectable SDR EOTF, Windows SDR white level, tone map
- Compose pass decodes every texel to linear (premultiplied) before filtering, converts the plane to the output's linear
  working space (Rec.2020 nits for HDR10, Rec.709 relative to SDR white for SDR), blends there and encodes once.
- SDR EOTF is piecewise sRGB by default (community-sourced Windows behaviour), gamma 2.2 by
  XboxPresentation::set_sdr_eotf or LEONIDA_SDR_EOTF=gamma22.
- SDR white: set_sdr_white_nits override, else DISPLAYCONFIG_SDR_WHITE_LEVEL of the window's output while HDR10 is
  active, else 203 nits (BT.2408).
- HDR10 on an SDR output: extended Reinhard on luminance (white point at the content peak, default 1000 nits) instead of a
  hard clip.
- HDR metadata stays unsent; docs section 4.5 documents the decisions and cites the sources.
- CPU reference model and xbox_present_test updated (linear model, EOTF option, 50% overlay, tone map, white level query).
- present_compose.inc rebuilt with glslc 2026.4 (byte-reproducible, spirv-val clean).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:17:24 +01:00
47449d3e29 Merge pull request #2729 from itsRevela
# Conflicts:
#	docs/design.md
2026-11-22 13:17:24 -05:00
5dbd34dacc Merge pull request #2728 from Størm 2026-11-22 13:17:23 -05:00
5b63f6da7c Merge pull request #2722 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 13:17:21 -05:00
9f53808e02 Merge pull request #2713 from Capital 2026-11-22 13:17:16 -05:00
4e646b96c1 Merge pull request #2712 from Davide 2026-11-22 13:17:15 -05:00