Commit Graph

5744 Commits

Author SHA1 Message Date
553f0df328 docs: drop the Byte permute row the #222 merge duplicated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:09:57 -05:00
cc1f4d3597 Merge pull request #230 from Jan Trencansky
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 17:09:46 -05:00
01bc91eb2c Merge pull request #222 from simonbronk
# Conflicts:
#	docs/design.md
#	tests/semantic/regen_fixtures.py
#	tests/semantic/spirv_mini_interp.py
2026-11-21 17:09:28 -05:00
78bac0ead5 Merge pull request #235 from shuv-amp
# Conflicts:
#	tests/semantic/regen_fixtures.py
#	tests/semantic/spirv_mini_interp.py
2026-11-21 17:08:27 -05:00
345465a2d6 Merge pull request #257 from IAmNotSiob 2026-11-21 17:07:42 -05:00
5773165b67 Merge pull request #241 from 0xTehuti 2026-11-21 17:07:42 -05:00
b80e3baddf Merge pull request #228 from Jan Trencansky 2026-11-21 17:07:41 -05:00
77c466c5b5 Merge pull request #224 from 0xTehuti 2026-11-21 17:07:41 -05:00
fdaf5e402e Merge pull request #246 from LuanFreitas 2026-11-21 17:07:40 -05:00
c1686b84e0 Merge pull request #223 from Alex Collini 2026-11-21 17:07:38 -05:00
e555237b31 Merge pull request #255 from SuarezPM 2026-11-21 17:07:37 -05:00
9c7573078d Merge pull request #248 from Ayinaki 2026-11-21 17:07:37 -05:00
3176cecd72 Merge pull request #251 from Kam471 2026-11-21 17:07:35 -05:00
69b578eefa Merge pull request #229 from Kam471 2026-11-21 17:07:35 -05:00
b59427776d Merge pull request #225 from Kam471 2026-11-21 17:07:35 -05:00
74863bfa91 Merge pull request #190 from Kam471 2026-11-21 17:07:35 -05:00
cd10e30ac6 Merge pull request #181 from Kam471 2026-11-21 17:07:34 -05:00
d4a44d3fcc Docs/Tests: sync mesh v5 notes in design.md and add NumThreads constant regression test 2026-11-21 14:07:28 -08:00
36bc1200ad Runtime: offline xgameruntime shim (XGameRuntime, XSystem, XTaskQueue, XAsync)
Every GDK title calls XGameRuntimeInitialize first and builds its async work on
XTaskQueue/XAsync. Add an xgameruntime.dll shim table for those, ahead of the
executable: XGameRuntimeInitialize/Uninitialize (reference counted),
XSystemGetDeviceType (Series X; LEONIDA_DEVICE_TYPE overrides) and
XSystemGetConsoleId (placeholder), plus the 23 XTaskQueue/XAsync functions.

XTaskQueue/XAsync come from microsoft/libHttpClient (MIT), copied unmodified
into third_party/xtaskqueue (task queue only, no HTTP stack); a small pch.h
stand-in lets them build alone. xgameruntime_test drives the table through
the shim registry the way a title boots. Nothing goes online.
2026-11-21 23:06:10 +01:00
188fb19d0e Tools: CPU differential oracle for the translator (shader_diff.py)
AI-assisted. New runner comparing tools/cpu_ref.py (ISA model, untouched) against rdna2spirv + tests/semantic/spirv_mini_interp.py (translated SPIR-V), bit-exact over seeded straight-line ALU programs.

- tools/shader_diff.py: program table (12 verified vector ALU ops), seed handling, first-mismatch report (case, seed, lane, register, expected/actual bits, last-writer op), counted skips with reasons, exit 0/1/2, --self-test canaries (a passing case, an intentionally wrong expectation that must fail, an unsupported op that must skip).
- tests/test_shader_diff.py: determinism, mismatch + NaN controls, skip accounting, fixed-seed end-to-end run, self-test gate.
- docs/shader_validation.md: harness-design paragraph updated to the shipped tool.

Verified here: 6 pytest green; 400 seeded programs, 0 mismatch, 0 skipped, 0 harness errors; mutation check (blinded comparator) turns 3 tests red; compileall + make_game --help green. Scope is the harness only: no changes to cpu_ref semantics, no GPU needed, runs in standard CI.
2026-11-21 19:05:43 -03:00
58ebeccef0 Tools: export short streamed-music idents by duration 2026-11-21 22:05:28 +00:00
ae144b8f79 Allow an explicit Vulkan loader in macOS GPU tests 2026-11-21 15:02:34 -07:00
8200f0523b Docs: link the gamedata XML catalog from the design table 2026-11-21 22:02:24 +00:00
2fecf12124 fssm_header: parse the post-code binding table
Decode the filler, header, 20-byte records and name record after
code_end, and add a --bindings summary. Measured over 26,503 blobs:
5,640,704 records, all parse.
2026-11-21 21:59:15 +00:00
34f63c6c62 Translator: detect wave64 from 64-bit lane-mask SOP ops (#210)
Shaders that only use s_bcnt1_i32_b64 (and related mask ops) on ordinary
SGPR pairs were translated as wave32. Treat those ops as wave64 markers
and add a GPU test that expects a count of 48.
2026-11-21 18:57:04 -03:00
d5eabdad6a Runtime: CopyDescriptors and CopyDescriptorsSimple on the Vulkan device
A descriptor is the bytes of its heap slot (a TargetView in RTV and DSV
heaps, otherwise what the shader loads), so both are byte copies.
CopyDescriptors walks the destination and source range lists together,
one descriptor at a time; null size arrays mean one descriptor per range,
and whichever side runs out first ends the copy.

Test: d3d12_descriptor_test, through the Xbox-ABI proxy, checks the slots'
bytes for one run, range lists of different shapes on each side, null
size arrays, a destination longer than its source, and null arguments.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 16:56:56 -05:00
69ff8e5c72 Runtime: bindless set 0 (M2)
Set 0 as the translator declares it (docs/design.md, docs/d3d12_vulkan.md
section 5), in runtime/src/vulkan_bindless.h: the twenty bindings with the
array sizes vk_pipeline_check uses, and DescriptorTable (descriptor_table.h)
behind binding 2.

- An image has one index in its dimension (2D, 2D array, 3D, 1D), the same
  in every binding of that dimension. The storage arrays hold 256, so an
  image with a storage view gets an index below 256 and a read-only one
  goes above while there is room.
- Index 0 of every array is a fallback (a 1x1 image of zeros, a nearest
  clamping sampler), because a miss in the table is index 0.
- Changes are queued and written by flush(), one write a slot: a view
  removed before the next flush is never written, so it may be destroyed
  at once.
- insert_key / erase_key change the table; flush() copies it to the buffer,
  into a new and larger one when it has grown. Erasing compacts a probe
  cluster, which moves other keys' entries, and a new buffer rewrites
  binding 2: flush_needs_idle() says when a flush would do either, so the
  owner can make sure no command buffer that uses the set is still running.
- With update after bind the set may be flushed between submissions; with
  partially bound only index 0 is written at creation.

Test: vk_bindless_test, run by runtime/test/shaders/check.py and
scripts/run_gpu_tests.py. ps_tex.asm, a hand-written RDNA2 pixel shader
built by build.py, loads a T# and an S# from a descriptor table and
samples: the translator's own lookup against the table and the set. It
draws the gradient with the T# at the fourth slot probed, the fallback
after the key is erased, the gradient after the table has grown into a new
buffer, another view at the same index and the fallback after removal,
with and without the descriptor-indexing flags; and it adds, removes and
destroys a view before its first flush, which the validation layer reports
if the write is still made.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 16:56:56 -05:00
36ace7135e Merge pull request #222 from simonbronk
# Conflicts:
#	docs/design.md
#	tests/semantic/test_alu_perm_alignbit.py
#	tools/rdna2spirv.py
2026-11-21 16:56:10 -05:00
047d4d9b60 Wave64 emulation: guard the chained voted branch, more tests, bench reference
Raise Unsupported when a voted branch's segment was not started by the vote's
own round. New tests cs_w64x_mask_reuse2 (EXEC reuse, read after a store,
half of a mask pair rewritten, chained successor starting with a conflicting
load) and cs_w64x_chain_barrier (chained successor starting with s_barrier),
plus a translation test counting mask exchanges. bench_wave64.py reports a
missing bench line readably and compares against the native AMD output.
design.md: how the rules were confirmed, current GPU counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:52:35 +01:00
cdaef79a7d Wave64 emulation: fewer rounds (reuse mask exchanges, chain voted branches), benchmark
A whole-mask read of a register value already exchanged in the block reuses
the exchange; a block ending in a voted branch runs its successor in the
round that reads the vote. Adds scripts/bench_wave64.py, cs_bench_mix,
VKC_BENCH timing in vk_compute_test and the cs_w64x_mask_reuse test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:52:35 +01:00
c33c216cbd Runtime: implement CheckFeatureSupport for format support, VA limits, and options (D3D-11) 2026-11-21 22:52:10 +01:00
87700c04cf Zero disabled source lanes in wave32 ds_bpermute_b32
RDNA ISA 10.4.4: EXEC is honoured for reading the source, so a source lane
that is off reads 0. The wave64 paths did this already; the wave32 path
shuffled the raw value. New GPU test cs_bpermute32 (wave32), wired into
check.py, run_gpu_tests.py and tests/test_shader_checks.py; LDS row of
docs/design.md updated. ds_permute_b32 stays Unsupported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:51:44 +01:00
63cd7b8fe6 Docs: record the measured title-keyed stream-id resolution 2026-11-21 21:51:15 +00:00
64ebdf692f Tests: integer ALU shaders ps_ops7/ps_ops8 and the SPIR-V ops they need (on top of #216)
ps_ops7 checks v_perm_b32 (selectors 0x0c0d0700 and 0x0b0a0908, the sign
selectors fixed in #216), v_alignbit_b32 with a shift of 36, and
v_med3_i32 against v_med3_u32. ps_ops8 checks v_mul_hi_u32/i32,
v_bcnt_u32_b32, v_ffbl_b32, v_ffbh_u32 (also of 0), v_xad_u32 and
v_add3_u32. Both run on the GPU (check.py, run_gpu_tests.py) and in
test_value_semantics.py against plain-Python references.

The mini interpreter gains OpUMulExtended, OpSMulExtended, FindILsb,
FindUMsb, UMax, SMin, UClamp and SClamp. docs/design.md gets the byte
permute contract row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:43:57 +01:00
0532026c35 Translator: 10:10:10:2 buffer formats had x and w swapped
GFX10 format names list the channel widths from the top bit, so 2_10_10_10
(50) is R10G10B10A2 and 10_10_10_2 (44) has a 2-bit x. FORMATS read them
from bit 0, which swapped the two for typed buffer loads and stores.

cs_store now writes its R10G10B10A2 word through 50. cs_fmt_1010102 covers
both formats; to run it, buffer_load_format masks a shift that was 32 for
aligned elements, and the test interpreter gains the conversions it needs.
2026-11-22 03:28:27 +05:45
f70a588381 Tests: cover multi-group stereo streamed music 2026-11-21 21:39:33 +00:00
019f0fc241 Docs: update the full tree JSON size 2026-11-21 21:38:51 +00:00
4c2f143d83 Runtime: check maxPushConstantsSize at device creation and flag uniform-buffer fallback (D3D-14) 2026-11-21 22:38:22 +01:00
2b33695b36 Merge pull request #204 from crastinator
# Conflicts:
#	docs/design.md
2026-11-21 16:37:50 -05:00
49f24bf596 Merge pull request #219 from Diesel 2026-11-21 16:37:31 -05:00
caac27bfe3 Merge pull request #209 from Tim Elery 2026-11-21 16:37:31 -05:00
ae72c1a376 Merge pull request #215 from Kam471 2026-11-21 16:37:29 -05:00
79bc64c608 Merge pull request #190 from Kam471 2026-11-21 16:37:29 -05:00
bdc5834266 Merge pull request #183 from Kam471 2026-11-21 16:37:28 -05:00
0a57596c88 Translator: accept LLVM 23's 0x80 in unused VOP3 source fields; check for a .NET SDK, not just dotnet
LLVM 23 prints a VOP3/VOP3P source it doesn't read (SRC1/SRC2 of one- and
two-source ops) as 0x80, inline constant 0, where the game's compiler stores 0.
Re-anchoring in shaders with code-embedded data compares the printed encoding
with the blob, so those instructions never matched and 1,471 of the 1,473 such
shaders were rejected ("reachable instruction with normalized encoding").
same_encoding now ignores an SRC1/SRC2 field only when it is 0 in the blob and
0x80 as printed; a source LLVM does read prints as decoded (s0), so a real
difference still fails. The existing VOP3P op_sel_hi rule now combines with it.

make_game.py: `dotnet` is on PATH with only the .NET runtime, and the asset
stage then fails in `dotnet build` ("No .NET SDKs were found"). The preflight
now asks `dotnet --list-sdks` for an SDK 8 or newer.

Tested on Windows 11, LLVM 23.1.5 (MSYS2 UCRT64 llvm-tools), the 1,473
shaders with embedded data, disassembled with this branch's shader_disasm.py:
  main:        2 translated, 1471 "normalized encoding"
  this branch: 1473 translated, 1473 pass spirv-val
Full corpus on the earlier tree with the same rule: 26,503/26,503 pass.
.NET check: false with only the runtime installed, true after adding SDK 8.0.428.
No GPU pipeline run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qV4hmKSJmU6cXAgrehZzr
2026-11-21 22:36:07 +01:00
d27e4c5765 Runtime: ResolveSubresource and multisampled textures on Vulkan
There was no resolve, and a multisampled committed texture was refused.

- IR: ResolveSubresource (two different resources).
- Replay: ResolveSubresource is vkCmdResolveImage in the layouts copies
  use: a multisampled colour subresource into a single-sampled 2D one of
  the same size and format. Depth-stencil resolves and resolves between
  two formats of a typeless family stay unsupported. ResourceBinding gains
  samples: a multisampled texture copies only to its own sample count and
  has no footprint.
- Device: committed multisampled 2D textures (single-mip render targets or
  depth-stencils, when the GPU has the sample count for the format; the
  other shapes are E_INVALIDARG as in D3D12), and TEXTURE2DMS
  render-target and depth-stencil views.
- COM: ID3D12GraphicsCommandList::ResolveSubresource.

Tests: command_list_test (recording rules, and a copy with a z range);
vk_command_replay_test part C (a 4x resolve and the refused resolves and
multisampled copies; it also runs the volume copies that are already on
main at the Vulkan level, on Linux too: a 4x4x4 volume uploaded, copied as
a block and whole, read back, and the z ranges that must be refused);
d3d12_vulkan_device_test (a resolve through the Xbox-ABI proxy and the
refused shapes).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 16:34:22 -05:00
48adc7b9a5 Translator: v_perm_b32 sign selectors 8-11; integer ALU tests ps_ops7/ps_ops8
v_perm_b32 returned 0x00 for selectors 8-11. Per the RDNA ISa BYTE_PERMUTE
they give 0xff when bit 7 of byte 1, 3, 5 or 7 of {src0, src1} is set. Each
byte pick also shifted both sources by up to 56 bits (undefined in SPIR-V,
the select kept the right one); the shift is now (sel & 3) * 8 on the source
chosen by sel < 4.

New test shaders, checked on the GPU (check.py, run_gpu_tests.py) and in
tests/semantic with expected words derived from the ISA:
- ps_ops7: v_perm_b32 (byte picks, 0x00/0xff, sign selectors), v_alignbit_b32
  with a shift of 36, v_med3_i32 vs v_med3_u32.
- ps_ops8: v_mul_hi_u32/i32, v_bcnt_u32_b32, v_ffbl_b32, v_ffbh_u32 (of 0),
  v_xad_u32, v_add3_u32.

The semantic interpreter gains OpUMulExtended/OpSMulExtended,
OpUGreaterThanEqual and GLSL FindILsb, FindUMsb, UMax, SMin, UClamp, SClamp,
with direct tests; the unsupported-ext example moves from FindUMsb to Ldexp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:33:25 +01:00
e8a0b11ada Test mesh v5 against all 24 coordinates of a 3D draw 2026-11-21 22:33:25 +01:00
ded3576dad Tools: separate placement maps from CMapData-only metadata in the census 2026-11-21 21:32:11 +00:00
2992956624 rbf0_tree: record child counts, add CSV rows and tree-shape summary
Each element now carries attrs_actual, children and content_count. The JSON summary reports the measured depth and child-count histograms, leaf/empty/text-only counts and parent-child edges. --csv writes one flat row per node with parent, slot and sibling columns. Tests cover sibling order, malformed close tags against the flat parser, tree-shape summary and CSV output. The docs replace the game-name sample trees with aggregate tree shape and a synthetic example.
2026-11-21 21:30:42 +00:00