MUBUF/MTBUF accesses follow the RDNA2 ISA's swizzled buffer addressing
(8.1.5, tables 33/35/37) with the V# fields of Mesa's gfx10-rsrc.json:
SWIZZLE_ENABLE word1 bit 31, INDEX_STRIDE word3 [22:21], ADD_TID_ENABLE
word3 bit 23, element size fixed at 4 bytes. ADD_TID adds the wave lane to
the index (swizzled or linear), dword k of a swizzled access is 4 * IS bytes
after dword k - 1, and OOB_SELECT 3 with swizzle and a stride checks like
mode 0. Literal V# words fold; run-time ones use IS = 2^(swz * (3 + n)), so
IS = 1 is the linear address. A literal swizzled V# used to be Unsupported
and a run-time one was translated unswizzled.
Tests: tests/semantic/test_buffer_swizzle.py (hand-worked addresses, literal
and run-time V#s) and the GPU fixture cs_buf_swizzle.asm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_quadmask ORs each nibble of S0 into one bit (8 quads for b32, 16 for
b64), SCC = D != 0; s_bitreplicate_b64_b32 doubles every bit of S0 into
a 64-bit pair and leaves SCC. Both are built from fixed shift/mask steps.
A lane-mask operand stays Unsupported: one invocation holds only its own
lane's bit.
tests/semantic/test_salu_quadmask_bitreplicate.py checks fixed and seeded
values, SCC written or kept, immediates, aliasing and the rejected
lane-mask forms. docs/design.md row added.
docs/d3d12_vulkan.md: device_default, flags-02785/-08988 for REQUIRE_FULL_SUBGROUPS,
the probes and the wave64 pixel-shader test. docs/design.md: the subgroup prose
sat in the middle of the metadata field list; the list is whole again and the
prose follows it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
docs/d3d12_vulkan.md: a "Subgroup size" part in section 3.2 (index fields,
device features and limits, the per-stage rule with its VUIDs, what the log
says), the two new tests, the known gaps, and the wave size rows of the PSO
checklist and the risks. docs/design.md: the metadata row said 64-wide subgroups
can only be requested for compute and mesh. The AMD Windows driver (measured on
a Radeon 880M, 26.11.2) lists FRAGMENT | COMPUTE | TASK | MESH, and current Mesa
RADV on GFX10+ COMPUTE | FRAGMENT | task/mesh (radv_physical_device.c,
requiredSubgroupSizeStages), so wave64 pixel shaders can run exact on AMD.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ds_nop is the DS no-operation; v_clrexcp clears the TRAPSTS exception
bits, which nothing translated reads (s_getreg_b32 is unsupported and
there are no traps). Both raised Unsupported; they join NOOPS.
test_sopp_noops.py covers them and the design row lists them.
tools/wave64_halves.py classifies each wave64 VS/PS/GS by partition
invariance: A exact as translated, B exact by construction (waterfall loops,
wave-aggregated atomics up to slot order, readfirstlane/readlane of values
that are the same in every lane), C not exact (lane counts/ranks/ids,
readlane of varying data, stale scalars behind votes, masks as data, ...).
index.json gets wave64_graphics, wave64_graphics_reasons and
wave64_graphics_idioms; --wave64-graphics warn|error|off (error refuses
tier C). One rewrite: readlane of a proven-uniform VGPR reads the own copy.
--census prints tier counts from an index.json. ps_w64_* fixtures,
w64_graphics.py (fragment subgroup size required 64 vs 32) and semantic
tests; vk_harness gets VKH_HEAP_DUMP and a subgroup-size report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The binary16 versions of v_frexp_mant_f32 / v_frexp_exp_i32_f32 / v_ldexp_f32, computed on the f16 word with
integer ops (no float arithmetic), op_sel on the source halves and the destination half. Semantic tests run
through the translator and the mini interpreter; contract row in docs/design.md.
AI-assisted (Claude), on behalf of dev-ewann.
LSNS is a u32 block count, a (u32 kind, u32 bytes) table, then the blocks,
each a whole number of 16-byte records; the empty form is 12 bytes.
psin_index.py now checks that layout per section and reports blocks,
record counts and errors. Over 5,217 sections in five archives it holds
with 0 errors.
The records are uniform bytes, occur nowhere else in their container, and
match no tested 32/64/128-bit name hash (joaat, FNV, CRC-32, Murmur3,
xxHash, MD5, BLAKE2b, SHA). psin.md records the layout and these negative
results; the contents may be encrypted and are left unread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docs/character_models.md and link it from the docs index and models.md.
The page records what the character export actually contains, so a preview
cannot quietly present a proxy or a placeholder as Lucia's hero asset:
- 26,585 manifest rows / 11,335 unique names: 23,720 drawables, 2,865 fragments.
- Every fragment exports as a 25-vertex bounds cube with Embedded: null; child
drawables are not walked.
- Lucia's 22 named records and the 13 decoded parts, with vertex/triangle counts
and albedo keys. The head drawable has no texture reference.
- The only Lucia full body is cs_lucia_legacypedcs (874/640-vertex rows,
1,748/1,816 decoded): a clothed legacy ped, not a base body.
- player_story000_00 is 104 unique names = 63 drawables + 41 bounds fragments.
- Slot-token counts, with the explicit caveat that they are a name heuristic.
- Texture coverage 184/215; only 0xC8E8C282 is sRGB albedo; hands/feet keys
unresolved.
- Not decoded: fragment children, a ped-variation table (the two common.rpf
managers are height/shape and gameplay components, not appearance),
Lucia's hair (3-vertex placeholders), levels.rpf names, and bind pose.
Conflicts were list/registration hunks in runtime/CMakeLists.txt, check.py, run_gpu_tests.py and tests/test_shader_checks.py; kept main's side and re-added vk_sampler_test, ps_ssharp and the TOTAL count.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six frames through a ring of three slots, each with its own fence. Pass 1 draws
three rectangles (translator-output vs_m3/ps_m3) into an RGBA8 and an R32F
target with depth LESS/write and stencil REPLACE/EQUAL, the far one inside an
OCCLUSION query; barriers move the targets to shader/copy-read states; pass 2
samples the first target through an SRV descriptor table. Every pixel and the
exact sample count match a CPU reference. No layer change was needed. Render
passes (D3D-27) stay open. The generic shader harness skips the fixtures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The differential fuzzer guide still described MTBUF selector behavior as unmeasured. Record the native bound, unbound and missing-channel behavior exercised by the reference tests.
image_bvh(64)_intersect_ray followed RADV's software path on triangle nodes,
which always reads vertex slots 0, 1, 2 and returns (v, w): RADV builds one
triangle per node. The hardware format packs up to four triangles per node,
and the node type picks the slots: TRI0 (0,1,2), TRI1 (1,3,2), TRI2 (2,3,4),
TRI3 (2,4,0). The type's byte of the triangle-ID word at +60 picks which two
vertex weights come back (bits [1:0] and [3:2]; 0x09 is RADV's v, w). A BVH
with paired leaves therefore traversed TRI1 against the wrong triangle.
Both rules come from AMD GPURT (CalcTriangleCompressionVertexIndices,
SwizzleBarycentrics, TRIANGLE_ID_I/J_SRC_SHIFT), and the public XDXR software
path (Read3Verts, TestXboxBvh4Leaf) agrees with it.
- tests/semantic/test_image_bvh_tri.py: every node type on a hand-built node,
every remap selector pair, the byte per type, selector 3, a zero word
- spirv_mini_interp: OpVectorExtractDynamic and GLSL.std.450 FSign, from the
specifications
- vk_compute_test "bvh": its hand-built triangle nodes now carry the 0x09
triangle ID a builder writes; expected words unchanged
- docs/design.md Ray tracing row, docs/bvh.md 7a, translator docstring
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A frame presented after the vblank it was due at is flipped at once (IMMEDIATE, else
FIFO_RELAXED) when the scan would be within the threshold percentage of the screen,
instead of waiting a whole interval. The decision is the pure
leonida::decide_present_sync(late_us, interval_us, threshold); FramePacer reports the
lateness against the vblank after the token's origin and records the tear in
GetFrameStatisticsX (PercentScanned) and immediate_presents().
VulkanPresenter creates a vsync swapchain with FIFO plus the tear mode when the surface
lists it as compatible (VkSurfacePresentModeCompatibilityKHR) and chains
VkSwapchainPresentModeInfoKHR on a tearing present. The device enables the KHR (else EXT)
extension, its feature and the matching instance extensions only where present; without
them the threshold is ignored and logged once, as before. LEONIDA_PRESENT_NO_TEAR=1 turns
it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replay refused binary occlusion resolves, and ordinary resolves that need a sum, while a pipeline-statistics
query was active: their compute helper would count in the application's CSInvocations.
A statistics query that contains a resolve (other than a timestamp copy) is now split. Its counters go to
physical PIPELINE_STATISTICS segments in a pool of the submission's own (flags 0x7ff, as the device creates
the heap). A segment ends before each such resolve and the next begins after it, so no helper dispatch runs
inside the application's query. The query's result is the sum of its segments: a new 11-counter compute shader
(statistics_sum.comp, encoded in statistics_sum_spirv.h like the occlusion helpers) adds them on the
occlusion-resolve scratch buffer. That sum is a helper dispatch too, and is kept out of any statistics query
still running by the same split. Whether a resolve dispatches is only known when the list is planned against
the heaps, so every such resolve splits the query.
The single-list replay() has no segment pool. It keeps refusing a resolve that dispatches inside statistics,
and now allows a binary resolve that only writes zeros. SetPredication and predicated copies are still refused
while statistics are active.
Tests, all with the Khronos validation layer on:
- vk_binary_occlusion: a binary resolve inside one statistics query, then the statistics sum of that query
inside a second one. Every counter of both is 0. With the split disabled, CSInvocations reads 64.
- vk_overlapping_occlusion: a 261-segment occlusion sum inside a statistics query, with a native draw in each
segment. The split query, and a second one split around the statistics sum, equal two unsplit queries with the
same draws on every counter, and CSInvocations is 0.
- replay_query_predication (CPU): the exact begin/end/dispatch order of a split query, and the refusal without a
segment pool.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two LDS exchanges at vaddr + offset0/offset1 * 4 (x64 for st64), the
addresses ds_write2_b32 uses; vdst gets both old words, written after
both exchanges so it may alias the address or data VGPRs.
tests/semantic/test_lds_wrxchg2.py runs them in the interpreter: offsets,
st64 steps, the same dword twice, aliasing and a rejected single-VGPR
vdst. docs/design.md row added.
MoltenVK compiles MSL with Metal fast-math on by default, and Metal then folds
an f32 compare of a NaN with itself: v_cmpx_eq/le_f32 on (NaN, NaN) give true
(ps_vcmpx_forms fails on every Mac). The MSL is byte-identical with fast-math
on and off, so it's Metal's compile option, not the translation; "on demand"
(2) doesn't help, 0 does.
runtime/test/vulkan_loader.h, which every Vulkan test program loads MoltenVK
through, now sets MVK_CONFIG_FAST_MATH_ENABLED=0 before loading it unless the
variable is already set. docs/design.md gets a contract row: fast-math off
doesn't remove the optnone NoContraction helpers (the cost part, @Jolymmiles)
and doesn't fix SHADER-182 (same valu_fuzz f16 mismatch either way).
Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_vcmpx_forms 4096/4096 exact;
run_gpu_tests.py 85 pass/52 skip/2 fail -> 86/52/1 native, 114/23/2 ->
115/23/1 with wave64 emulation (the remaining failure is ps_interp_f16_high,
fixed by #1407); ctest 25/25 either way; semantic suite 1220 OK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
Its dialogue pairs give the 1,019 lines the measured run was missing;
with it the conversation path names 267,800 streams. Also state the
dictionary size and that it came from our own harvest, not hashdict.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game's ray-tracing shaders read acceleration-structure nodes themselves
(docs/d3d12_vulkan.md 4.8), so a builder on the Vulkan layer must write the
console's XDXR BVH4 records. This adds the CPU reference for that builder:
- build_blas: triangles to header, parent table, leaves (TRI0, or TRI0/TRI1
pairs with per-triangle barycentric remap) and BOX32 or conservative BOX16
nodes
- build_tlas: 128-byte INSTANCE records with world-to-object transforms
- intersect_node: one traversal step with the hardware instruction's
semantics as the public XDXR software path describes them
- trace / brute_force: closest hit, checked against every triangle
- validate: header, pointers, nested bounds, parent table; CLI `validate`
for a locally dumped buffer, and `selftest`
Layouts come from docs/bvh.md 3.1 and the public XDXR traversal source it
cites; the region order, build heuristic and pairing are this tool's own
choices and are marked ASSUMPTION. docs/bvh.md 7a records each field's source
and an Open difference: the translator's image_bvh triangle path ignores the
TRI1-TRI3 vertex selection and the remap byte.
Standard library only; synthetic fixtures; no game files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check.py kills a GPU test program after 120 s and counts it as a failure;
LEONIDA_GPU_TEST_TIMEOUT changes the limit and 0 turns it off. The variable
was only visible in a code comment, so add the paragraph next to the
--filter/--work note in "Run them".
Docs only, no game data.
Both were rejected. Each half is the f32 source clamped to [-1, 1] or
[0, 1], scaled by 32767 or 65535 and rounded to nearest even: the NIR
pack_snorm_2x16 / pack_unorm_2x16 definition that Mesa ACO emits these
opcodes for. Built from FClamp, FMul, RoundEven and a convert rather than
PackSnorm2x16, whose rounding GLSL leaves open. NaN gives 0 (as
v_cvt_i32_f32; not measured). clamp is rejected.
tests/semantic/test_alu_cvt_pknorm_f32.py checks ties, infinities, NaN,
subnormals, out-of-range and seeded values and abs/neg. docs/design.md
row added.
The GFX10.1 VOP2 form of v_mad_legacy_f32 with D as the addend was
rejected. It now shares the v_mad_legacy_f32 branch (0 * anything = +0,
the denormal flush, VOP3 modifiers) with D read as src2, and D counts
as read for the first-read analysis, as for v_mac_f32.
MacLegacyF32Tests in test_valu_f32_min3_max3_mad.py compares it with the
v_mad_legacy_f32 reference over a value grid, and checks the zero rule,
clamp/neg and D aliased as a source. docs/design.md row added.
Text resources are 0DRP logical resources holding a joaat label hash table,
an index array and a UTF-8 string blob, located by a descriptor of
0x5xxxxxxx resource pointers. text_tables.py joins each 0DRP stream with
its 64 KiB continuations (carve directory or archive via gamedata_index, or
whole-resource files), decodes the tables, guesses each table's language
(script, distinctive letters, common words; es-ES/es-419 and
zh-Hant/zh-Hans by markers; xx when undecided), and joins conversation
key/label pairs (<key>_01.. waves) to their text in every language.
On 1.0.2.1: 30,349 tables / 7.17M strings; 118,351 dialogue keys and
138,104 lines, 88-93% with text per language. docs/text.md records the
format, the per-language conflict counts and the open questions.
Standard library only; tests are synthetic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The layer turned Vulkan feature bits straight into D3D12 support bits. On an
RX 9070 XT that disagreed with native D3D12 on the same adapter in 169
reported-but-absent bits and 761 absent-but-native ones. This change only
reports what the layer provides:
- UAV_TYPED_LOAD with every typed UAV (reads use the sampled binding), not
from STORAGE_IMAGE_ATOMIC; the UAV atomic bits other than exchange for
R32_UINT, the format with the r32ui storage view
- MIP where the image can have mips; SHADER_GATHER with SHADER_SAMPLE;
MULTISAMPLE_RENDERTARGET for depth formats
- no integer MULTISAMPLE_RESOLVE, no 1D block-compressed, no 3D or shader
reads of depth formats, and TYPELESS formats report only texture
dimensions and MIP
d3d12_vulkan_device_test compares these format-defined bits with native
D3D12 on the same adapter: 0 mismatches over 78 formats with this change,
249 on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- decode_grid20_table: 8-byte header (u32 12345678 marker + unknown) and N 20-byte
entries, with the invariants measured on all 1,185 audio.rpf streams that carry
the tag (counter strictly increasing, p a multiple of 32; 387,233 entries,
0 violations).
- decode_index_runs: K groups of {u32 2; u32 len; u32 hash; len ascending u32s}
whose values index the sibling 0x5a entries (804 streams, 4,853 groups,
0 violations, 0 overruns).
- Per-stream tallies in decode_awc_bank and the scan summaries (grid20_*/indexrun_*
keys), facts in _decode_companion_tags; other archives carry 0 of either tag.
- Five synthetic tests (hand-built bytes only); docs rows in rsc8_audio.md,
audio.md and the docs index, hypotheses labelled as such.