Commit Graph

18350 Commits

Author SHA1 Message Date
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
4aab723e34 Fix build destination checks through directory links 2026-11-21 22:43:06 +01:00
02a830f067 Translator: keep the v_alignbyte_b32 shift below 32, and test it
With src2 & 3 == 0 the byte shift is 0 and the left shift of src0 is 32 - 0 =
32, undefined in SPIR-V. Its result is discarded by the OpSelect, but SPIR-V
leaves the shift undefined even there. (32 - b) & 31 keeps it in range, as #201
does for v_alignbit_b32.

tests/semantic/test_alu_alignbyte.py checks every byte shift, the 2-bit
selector mask and an inline selector against a plain-Python reference.
2026-11-21 18:42:15 -03:00
eef6f14297 Translator: keep bitfield extracts inside 32 bits (v_bfe, s_bfe)
v_bfe_u32/v_bfe_i32 and s_bfe_u32/s_bfe_i32 passed offset and width straight to
OpBitFieldU/SExtract. SPIR-V leaves offset + count > 32 undefined, and that
happens for any field that runs past bit 31 (v_bfe: both are 5 bits; s_bfe: the
width is 7 bits). The width is now cut to 32 - offset, so the field stops at
bit 31: zero-filled for the unsigned extract, sign-filled for the signed one.
That is the value LLVM's constantFoldBFE (AMDGPUISelLowering.cpp) gives,
Src0 >> Offset.

test_alu_bfe.py: the i32 reference shifts arithmetically, the sweep no longer
skips offset + width > 32, and new tests cover such fields and s_bfe with
widths up to 127. test_mutations.py follows the renamed width operand.
2026-11-21 18:41:30 -03:00
69e1b260d9 Merge main into bpermute-partial-wave 2026-11-21 23:40:17 +02:00
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
8b4d2f781e Merge pull request #212 from Ayinaki
# Conflicts:
#	tests/test_shader_checks.py
2026-11-21 16:38:46 -05:00
6e0a3f08b5 test(runtime): register root_sig_test with CTest 2026-11-21 21:38:44 +00:00
a81bcb8284 Merge pull request #207 from LouisRiverstone
# Conflicts:
#	runtime/test/vk_harness.cpp
2026-11-21 16:38:32 -05:00
4c2f143d83 Runtime: check maxPushConstantsSize at device creation and flag uniform-buffer fallback (D3D-14) 2026-11-21 22:38:22 +01:00
e9cb0b0e68 Merge pull request #203 from Ayinaki
# Conflicts:
#	tests/test_shader_checks.py
2026-11-21 16:38:18 -05:00
6ae2755f29 Merge pull request #205 from Parakeet-Wheat
# Conflicts:
#	make_game.py
#	tests/test_shader_stage_resume.py
2026-11-21 16:38:11 -05:00
2b33695b36 Merge pull request #204 from crastinator
# Conflicts:
#	docs/design.md
2026-11-21 16:37:50 -05:00
981f40d7d1 Merge pull request #218 from Luiz Neves 2026-11-21 16:37:32 -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
e7cfd361d6 Merge pull request #216 from Luiz Neves 2026-11-21 16:37:30 -05:00
343fe4e682 Merge pull request #201 from Størm 2026-11-21 16:37:30 -05:00
bc9e77c8ba Merge pull request #213 from Jonathan 2026-11-21 16:37:30 -05:00
949dd28aa5 Merge pull request #221 from Koert Lichtendonk 2026-11-21 16:37:30 -05:00
127361c271 Merge pull request #220 from intelshadow 2026-11-21 16:37:29 -05:00
ae72c1a376 Merge pull request #215 from Kam471 2026-11-21 16:37:29 -05:00
2195577f15 Merge pull request #202 from avelev99 2026-11-21 16:37:29 -05:00
4367fb3029 Merge pull request #199 from fabianlanza 2026-11-21 16:37:29 -05:00
2def8871fb Merge pull request #196 from NWX10 2026-11-21 16:37:29 -05:00
124f9e5447 Merge pull request #195 from simonbronk 2026-11-21 16:37:29 -05:00
79bc64c608 Merge pull request #190 from Kam471 2026-11-21 16:37:29 -05:00
b6f21bb29a Merge pull request #186 from Diesel 2026-11-21 16:37:29 -05:00
bdc5834266 Merge pull request #183 from Kam471 2026-11-21 16:37:28 -05:00
c52f5be087 Merge pull request #181 from Kam471 2026-11-21 16:37:28 -05:00
2c79fe1058 Merge pull request #167 from 0xTehuti 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
8a7e5dce94 Docs: claim work in #156 before opening a pull request
@ItsNotRexed asked in #156 for claims to be made there before a PR is
opened. Say so where contributors and their agents look first:
CONTRIBUTING.md, AGENTS.md and the pull request template.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:33:56 +01:00
1aca9ee545 check.py: run cs_w64x_partial at subgroup 32 under wave64 emulation (TEST-20)
partial_wave_test always set VKC_SUBGROUP_SIZE=64. With LEONIDA_W64_EMULATE=1 the
shader is translated for any subgroup width, and on AMD, where 64 is available,
the emulated path was never run at 32 (#166, RX 6700 XT entry). Under emulation
it now asks for 32; without emulation it still asks for 64.
2026-11-21 18:33:55 -03: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
323341759a Translator: v_perm_b32 selectors 8-11 repeat a half's sign bit (fixes #211)
Selector bytes 8-11 gave 0x00. The RDNA2 ISA reference defines them as the sign
bit of a 16-bit half of {S0, S1} repeated over the byte: bit 15, 31, 47 or 63.
The byte's low two bits pick the half (0, 1 in S1; 2, 3 in S0), and the shift
is 15 or 31, so it stays below 32.

test_alu_perm_alignbit.py now covers 8-11 in every result byte, with #211's
probe values.
2026-11-21 18:32:41 -03: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
96c543374f Tests: cover the unknown-element-size diagnostic bucket 2026-11-21 21:29:46 +00:00
cdc67e4d20 GPU tests: report gs_tri/ms_tri as SKIP without geometry or mesh shaders (TEST-18)
vk_harness exits 77, the code vk_compute_test and vk_store_test already use for a
device that cannot run a test, when VKH_GS is set and the device has no
geometryShader, or VKH_MESH is set and it has no VK_EXT_mesh_shader. Before, a
missing mesh extension exited 1 and a missing geometryShader failed in
vkCreateDevice with VK_ERROR_FEATURE_NOT_PRESENT (MoltenVK, #166).

run_gpu_tests.py (gs_tri, ms_tri, ms_w64x_ballot, ms_clip) and check.py
(ms_w64x_ballot) turn that exit code into SKIP, quoting the harness's reason.
2026-11-21 18:29:45 -03:00
24115f1450 check.py and run_gpu_tests: run cs_bounds (num_records bounds check) 2026-11-21 21:29:30 +00:00
0c17741bf4 Viewer: retry failed chunk loads with bounded backoff 2026-11-21 17:29:15 -04:00
8a7e2da5c6 Shader stage: keep work folders built before disasm.done (no full re-disassembly and re-translation)
Since 7cc6068 (#126) the disassembly counts as finished only by disasm.done.
Work folders built before it have none, so their next build disassembled
the whole corpus again and, as that drops spirv/index.json, translated it
all again too: hours of work on a build that was already finished.

- A folder whose translation finished (spirv/index.json) but has no
  disasm.done gets the marker: translation only ever ran after disassembly.
- The disasm moved from its old place next to the carve folder is marked
  finished, so it is translated again as intended, not disassembled again.

Two tests in tests/test_shader_stage_resume.py; both fail before this change.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:28:37 +01:00
ed9c90a463 viewer/serve.py: answer only requests addressed to 127.0.0.1 or localhost (DNS rebinding)
The viewer binds to 127.0.0.1, which keeps other machines out but not
other web pages: a page on any site can point its own domain at 127.0.0.1
(DNS rebinding) and then fetch http://<its domain>:8765/world/... as
same-origin, reading world.json and the .glb chunks built from the
player's copy. Those requests still carry the page's domain in the Host
header.

send_head now refuses (403) any request whose Host is not 127.0.0.1,
localhost or [::1] (any port, any case, trailing dot allowed). A request
with no Host header (a local tool, never a browser) is still served.

tests/test_world_build.py: host_allowed cases, and a live-server test
where Host rebind.example gets 403 without the world data while
localhost/127.0.0.1 get 200. Both fail on main.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:28:32 +03:00
258efccde7 Tests: cover multi-group stereo streamed music 2026-11-21 21:28:09 +00:00
9eb04373fa Runtime: add DescriptorTable::erase() and autonomous vk_texture_test with synthetic shader 2026-11-21 22:26:49 +01:00