Commit Graph

5744 Commits

Author SHA1 Message Date
a9d8b8dcc1 test_buffer_format_narrow_int: measured d16 stores (review: d16 SINT path untested)
buffer_store_format_d16_xyzw into every narrow UINT/SINT format, read back
from gfx1036 (wave32 and wave64 alike): a SINT half is sign-extended before
the clamp. Dropping the signed d16 source for sint now fails 10 rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:01:06 +01:00
4f9afeb231 Merge remote-tracking branch 'origin/main' into shader-336-smem-negative
# Conflicts:
#	docs/design.md
#	tools/rdna2spirv.py
2026-11-22 18:00:42 +01:00
6670b2bca0 d3d12: order timestamp resolves after their writes on MoltenVK
On Apple GPUs MoltenVK samples a vkCmdWriteTimestamp in a blit pass of its own at the end of the current Metal
encoder. Nothing orders the vkCmdCopyQueryPoolResults resolve after that pass. The copy read the old value, or 0 for
a timestamp never written, so d3d12_vulkan_device failed under Wine on a Mac (t1 == 0). A minimal Vulkan program
reproduces it natively on MoltenVK 1.4.3 and 1.4.2: the copy was right 0 to 43 times in 200, in the same command
buffer, the next one or the next submit. KosmicKrisp and llvmpipe were right in every case.

Where driverID is MoltenVK, the queue sets and waits for a fresh VkEvent before each timestamp resolve that copies.
A submission with such a resolve also waits on the queue's timeline for the submission before it. Both measured
200/200 and 500/500. The timestamps are still the GPU's own. The events go back to a pool after a host reset once
their submission completes. d3d12_vulkan_device also checks a resolve in the execution after the write. Documented
in docs/d3d12_vulkan.md section 4.6.
2026-11-22 21:00:39 +04:00
722292feb8 Tests: cover the exact param28 overlap boundary 2026-11-22 14:00:28 -03:00
4c06877f6e meshlet_page: size the 42 40 00 00 vertex blocks and walk past them (ASSET-146)
The 42 40 block has a 0x80-byte header with the same slot words; tag 0x42
streams are 8 bytes a vertex and tags 0x21/0x26/0x27/0x28 4 bytes. Over
shared_minigame000.rpf 14,671 headers fit exactly and every one is followed
by a recognised chunk. The walk used to stop at these blocks; it now reads
1,569 streams instead of 335 (159,387 meshlets, 16.9M triangles), 0 left
unparsed. A 63 30 block slot past 4 takes its tag's stride. Positions and
attributes are not decoded. Counts only in docs/story.md; synthetic tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:59:30 +01:00
9d731bc11e Merge origin/main into shader-309-wave64-lds-limit
Conflict in tools/rdna2spirv.py: both sides added a module function
before cs_dispatch_state (ds_const_extent, check_printed_encodings);
both kept. main's new ds_mskor path now goes through lds_access, so it
is bounds-checked like the other LDS accesses (test added), and the
mock Gen in main's new test_lds_atomic_minmax/xchg tests gains
lds_bound/lds_access/lds_atomic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:59:04 +01:00
bd513088c1 xdxr_bvh.validate: offsetToParents is signed, only stored parent entries are checked (RT-151 review)
Console structures keep offsetToParents negative: the entries of the low units
(the leaves) fall before the header and are not stored; only the ones between
the header end and offsetToElements are. validate() read the field unsigned and
raised struct.error on 7 of 8 rehydrated BLASes (@wildheathen, @Flyander). It
now reads it signed and compares only entries whose address is in
[header end, offsetToElements). A synthetic structure in console layout
(negative offset, leaf entries dropped) covers it; a wrong stored entry and a
runtime build are still caught. docs/bvh.md 3.1 drops the Open note.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 11:58:02 -05:00
0190c6f852 XDXR: totalSizeIn64BNodes does not count the header, a structure is 64 * (field + 1) bytes (RT-151)
docs/bvh.md 3.1: u32@0x20 = 0x140 + 64 * totalSizeIn64BNodes, 271,627 of
271,627 streams. xdxr_build.comp wrote total_size / 64; the copy and
postbuild paths read the field as the whole size, and tools/xdxr_bvh.py
wrote and validated it the same way. Now the header writes total / 64 - 1,
MODE_COPY_AS and MODE_POSTBUILD use (field + 1) * 64, validate() and the
reference builder agree, xdxr_build.inc is regenerated (glslc 2026.4) and
d3d12_xdxr_rt_test reads the size the same way.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 11:58:02 -05:00
64b24f69fd SHADER-378: dynamic --f16-interp-fallback packing and per-pipeline SPIR-V half linking 2026-11-22 13:57:55 -03:00
2848b49de8 Measure clip dictionary coverage across fragment skeleton tables (ASSET-158) 2026-11-22 17:56:54 +01:00
c55056ff40 rdna2spirv: v_cvt_pknorm_i16/u16_f32 round the exact product once, as RDNA2 does (SHADER-363)
The f32 OpFMul of the clamped value and 32767 (or 65535) can land exactly on k + 0.5 while the exact product is just
below or above it; RoundEven then picked the even neighbour, one off from the hardware on 28 of 28 such inputs on an
RDNA2 iGPU (gfx1036, SHADER-339). The product's error Fma(c, s, -p) is exact, so on such a tie the translator now
takes floor(p) + 1 when it is positive, floor(p) when negative, and RoundEven when it is 0. Away from a tie both
roundings agree.

tools/pknorm_probe.py --oracle hw on the same iGPU now exits 0: all 134 words equal the translator's in wave32 and
wave64 under five MODEs. tests/semantic/test_alu_cvt_pknorm_f32.py's reference rounds the exact product once and
checks the twelve measured near-tie words (they fail on the old translation); tests/test_pknorm_probe.py expects
single rounding. docs/design.md: the three copies of the pknorm row become one, with both RDNA2 measurements.
2026-11-22 19:56:45 +03:00
ef3261c4ca rdna2spirv: support and verify packed int16 constant op_sel on RDNA2 (gfx1036) 2026-11-22 19:56:19 +03:00
de8b7750dc Merge remote-tracking branch 'fork/buffer-formats-all-v2' into buffer-stores-rdna2
# Conflicts:
#	docs/design.md
2026-11-22 17:56:03 +01:00
a012fe0c1f SHADER-337: GPU test of image_sample_o, image_sample_b_o and image_gather4_l_o with texel offsets
ps_texoff_forms runs the three forms on vk_texture_test's texture with ps_texoff's per-pixel offset (all 64 pairs in
-4..3). check.py and run_gpu_tests.py judge it with texoff_words(..., "ps_texoff_forms"); unit tests check that a
dropped or swapped offset fails. 4096/4096 pixels exact on an RTX 4090 and on a gfx1036 iGPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:56:02 +01:00
4daddab099 fix(shader): preserve flat reads of interpolated f32 inputs
When one input location is read both through a P0 move and through a smooth interpolation pair, Vulkan interpolation loses the original vertex value. Retain the three vertex values so each instruction can use its own input rule.
2026-11-22 17:55:58 +01:00
eceff01dfa docs: add the Italian (it) community quickstart
Translated from the current README (build, prerequisites, troubleshooting, contributing); synced with 4eb6155d. Adds its row to docs/i18n/README.md and the code to the docs index. test_i18n_index, test_docs_links, test_docs_repo_paths and test_docs_list_items pass.
2026-11-22 17:55:54 +01:00
4945add25f rdna2spirv: typed stores follow the hardware (f16 toward zero, one NORM rounding, two-component routing), all 77 codes
@AwkGrep256 ran tools/buffer_format_fuzz.py on a real RDNA2 (gfx1036, #2022): the same totals as the
Radeon 880M, 0 mismatches, and 199,144 elements of the 14 GFX10-only codes, also 0. This follows both.

- 16_FLOAT, 16_16_FLOAT and 16_16_16_16_FLOAT format stores round toward zero, saturate at +-65504 and
  keep a NaN a NaN (Gen.ufloat_encode_bits, now with an optional sign). d16 data rounding (#1759) is
  not touched.
- Every UNORM, SNORM and SCALED store rounds the exact product once (Gen.norm_encode_exact): 0.3 *
  65535 stores 19661, not 19660.
- A two-component format stored through a V# takes channel y as its second component when DST_SEL_Y is
  Y and DST_SEL_Z a constant (the runtime's X,Y,0,1: gfx1036 narrow-integer fixtures, gfx1150), and
  channel w otherwise (identity XYZW, @AwkGrep256 and gfx1150); _xy then writes (x, 0). tbuffer keeps
  (x, y). A probe with XYZW alone would have shown (x, w) for every V# and broken the runtime's
  selectors, which the oracle now also covers (XY01 runs for the two-component formats).
- Gen.FORMATS has all 77 codes: 30-35 and 37-42 (10_11_11 and 11_11_10 with UNORM..SINT) join.
- buffer_format_fuzz: the model has one store route per path, select_formats runs all 77 codes by
  default on a GFX10 device, the known-difference count is gone (0 on the 880M).

The three expectedFailure tests pass; the fixtures that baked the old behaviour (cs_fmt_sint32, test_translate
f16 and int32 store tests, test_value_semantics) take the measured words. Sizes: cs_store 206 KB on
main, 125 KB here.

Co-Authored-By: AwkGrep256 <AwkGrep256@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 17:55:37 +01:00
43b14b884c docs: world.md no longer says the pinned LooksLikeFragment rejects .#ft headers (PROC-121)
breadbbbb/rpf9-explorer#8 (null optional header pointers, range-checked
16-bit fields) and #10 are both ancestors of Leonida's pin e2939175, so the
pinned explorer accepts the fragment headers the sentence said it rejects.
Say that, keep the 41.3% as the figure at the earlier pin 917e9b9, and note
that the 99.96% was measured on 917e9b9 with #8/#10 applied, not recounted
at e2939175.
2026-11-22 10:54:37 -06:00
6958558128 rdna2spirv: implement v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 2026-11-22 17:53:07 +01:00
4c9d995b26 Runtime: DisableThreadLibraryCalls from a mapped DllMain succeeds
The real DisableThreadLibraryCalls only accepts a module the Windows loader
mapped, so for a manually mapped image it returned FALSE. A DllMain that
returns its result (the MSVC runtime's msvcp140_1, msvcp140_2,
msvcp140_atomic_wait and msvcp140_codecvt_ids DLLs do) then made
Loader::initialise() throw "DllMain returned FALSE".

shims/library_loader.cpp serves the call next to FreeLibrary: TRUE for a
module the shims own or the loader mapped, the real function for any other
handle. New dll_thread_calls_test (CRT-free fixture DLL) fails on main and
passes with this change; docs/runtime_imports.md counts follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 17:52:04 +01:00
97daa1aec0 Merge origin/main into presentx-planes
Keeps the swapchain_colorspace enable and main's custom border colour extension in
create_vulkan_device_standalone; the present compose path follows main's LayoutPieces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:51:53 +01:00
18d8ff0bf8 rdna2spirv, lane_masks: distinguish wave64 vcc_lo/vcc_hi data writes from half-mask writes 2026-11-22 08:51:47 -08:00
497fbb7649 docs: record the ped variation manager's literal model keys 2026-11-22 16:51:12 +00:00
6cb7735c22 xgameruntime: own gameplatformservices.dll, XCurl's other way into the runtime
XCurl.dll reads HKLM\Microsoft\GamingServices ServiceRetryTimeout, then
LoadLibraryExW(L"gameplatformservices.dll", nullptr,
LOAD_LIBRARY_SEARCH_SYSTEM32) and GetProcAddress'es GetApiVersionImpl and
QueryApiImpl (disassembled, no code run). The shims didn't own that module,
so the load went to the host: on a PC with Gaming Services it would reach
the real PC runtime's QueryApiImpl and bypass the offline classes; without
it XCurl returns 0x87E00196. Either way the result depended on what the
player has installed.

The shim table now serves gameplatformservices.dll!QueryApiImpl (the
offline one) and GetApiVersionImpl(uint64_t*, uint64_t*), measured at its
call site (two pointers to 64-bit locals, result unread; XCurl compares the
pair with the last one it saw), writing the same two values every call.
owns_dll() follows from the table, so library_loader answers the load.

xgameruntime_test: the LoadLibraryExW(..., SEARCH_SYSTEM32) load, the
versions and the shared QueryApiImpl (+3, 65). docs/runtime_imports.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:49:51 +00:00
3b05703f3a docs: record the full raw-RSC body scan 2026-11-22 16:49:49 +00:00
4b6e54b1da Merge upstream/main 2026-11-22 17:49:12 +01:00
1ec817add5 tools: vint_diff.py, a differential fuzzer for 32-bit integer VALU in every encoding and source kind
A separate ISA model for 55 integer opcodes (VOP1/VOP2 as e32 and e64, VOP3-only ops, VOPC e64 + v_cndmask) with VGPR, SGPR, inline, float-inline and literal sources within the encoding and constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle. A mask read as data (#293) only with --known.

AI-assisted.
2026-11-22 17:49:10 +01:00
9c159e8285 docs: record the 6stars format facts that reproduce
Re-measured against the local package: the RPF9 stream boundary that ends a system prefix (and the negative on the 8 MiB rule), the PRD0 member type codes, and the navmesh polygon +4 packing. The navmesh road/pavement bit labels did not reproduce and are recorded as such. 6stars is cited as independent corroboration; no code was copied and the repository has no licence.
2026-11-22 16:48:48 +00:00
0ec464b0e1 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 18:48:05 +02:00
c7e2fa477c Translator: gather wrap/mirror take the modulo with OpSRem and a fix-up, not OpSMod (AMD Windows driver)
On a Ryzen 5 7600's iGPU (RDNA2) with AMD's Windows driver 24.10.24, OpSMod of a negative coordinate came
out with the dividend's sign, so ps_gather_wrap's three cases with a negative wrap or mirror coordinate
fetched outside the image and read zeros. Gen.gather_addr now computes c mod n as OpSRem plus n when the
remainder is negative, the same value for a positive period; the same module is then exact there, and still
on an RTX 4070 SUPER. tests/test_translate.py counts the new instructions; docs/design.md records why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:47:15 +02:00
8d89bfa647 Translator: --pc-tail-ubo moves the push-constant tail to a uniform block for 128-byte devices
A device whose maxPushConstantsSize is 128, Vulkan's minimum (AMD's Windows driver on RDNA2 iGPUs, some
Intel Arc drivers), can't take the 144-byte block (152 with --mesh-compute). With --pc-tail-ubo the
push-constant block keeps s0..s31 (128 bytes), and the tail that follows them by default (heap base, code
base, the --mesh-compute output address) becomes %pc_tail, a uniform block at set 1, binding 0, with the same
members in the same order. It is declared only when the shader reads the tail; the index records "pc_tail"
and 128 push-constant bytes, and "bindings" still lists set 0 only. Without the flag nothing changes.

Step 1 of the uniform-buffer tail claimed in #1902; the GPU harnesses and the D3D12 layer that bind the
block follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:47:04 +02:00
4f086c32b0 Tests: link f16 fallback stages at the producer's output limit (TEST-398) 2026-11-22 13:47:04 -03:00
6d4cc4cd0a rdna2spirv: v_dot4_i32_i8 op_sel/op_sel_hi and clamp (FSPX) 2026-11-22 17:46:51 +01:00
44e9921160 Merge current main into the streamed AWC fix
Keep the per-chunk checks and repeated Opus packet verification alongside the short-final-block fix already on main. Set accurate mono and stereo sample counts in the overlap fixture so it also exercises the current Ogg trimming behavior. AI-assisted.
2026-11-22 17:46:47 +01:00
cfdc3bab0d fix(shader): preserve channels across partial color exports
An EXP component mask can write different channels of the same MRT across multiple instructions. Retain disabled components from that target so a later export does not erase color that an earlier instruction wrote.
2026-11-22 17:45:32 +01:00
b643dfb4e5 Merge remote-tracking branch 'origin/main' into bf2022
# Conflicts:
#	docs/design.md
#	tests/test_shader_checks.py
2026-11-22 17:45:20 +01:00
ade957c80f xgameruntime: serve XSystemImpl (IXSystemImpl5) offline through QueryApiImpl
libHttpClient.GDK.dll asks QueryApiImpl for XSystemImpl with IXSystemImpl5's
interface id and calls slots 3-8 (thunks disassembled, no code run): three
(size, buffer, used) id queries, then two pointers, one pointer and a bool:
xgameruntime-docs' IXSystemImpl list (console id, Xbox Live sandbox id,
app-specific device id), IXSystemImpl3's (XSystemHandleTrack,
XSystemIsHandleValid) and IXSystemImpl4's (XSystemAllowFullDownloadBandwidth),
IXSystemImpl2 and 5 adding no known method.

Offline answers: the existing 39-byte console-id placeholder, sandbox
RETAIL, a 45-byte app-specific device-id placeholder (short buffers get
ERROR_INSUFFICIENT_BUFFER, null E_INVALIDARG), handle tracking accepted and
never called back, a non-null handle valid, bandwidth S_OK.

docs/runtime_imports.md: libHttpClient calls five classes through thunks
(not only an id table, as the table said): their slot ranges, with the
XSystemImpl and XPackageImpl rows. xgameruntime_test +5 checks (74).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:44:20 +00:00
b92bdd3948 TEST-251: GPU checks of wave64 geometry shaders, and no false tier C for a GS's ring address
rdna2spirv maps a legacy GS's LDS write to an output slot from its
offset alone and drops the VGPR address (the lane's GSVS area), but
wave64_halves read that address as the store's data, so a GS whose lane
id only forms its GSVS base was tier C lane-id. It now checks only the
data operands of a GS ds_write.

w64_graphics.py draws gs_w64_a_ring and gs_w64_c_lane_id at wave64 and
wave32 (RADV_PERFTEST=gewave32), build.py builds gs_* fixtures with
gs_tri's signatures, docs/testing.md explains how to run and extend the
wave64 graphics checks, and docs/design.md records the rule and that the
corpus GS are written for wave64. Checked on an RX 9070 XT (GFX1201) and
a Ryzen 9800X3D iGPU (GFX1036), RADV Mesa 26.3.1: 23/23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:44:04 +03:00
f2d7501f1d Merge pull request #2308 from AREA52 Agent 2026-11-22 11:44:03 -05:00
5b6eba2d8f Merge pull request #2303 from JavierBlanco23
# Conflicts:
#	docs/design.md
2026-11-22 11:44:00 -05:00
02956dea87 Merge pull request #2299 from Kam471 2026-11-22 11:43:56 -05:00
ae21dddaa6 Merge pull request #2290 from 1TrickOmen 2026-11-22 11:43:51 -05:00
2b0a8b6be4 Merge pull request #2288 from Kam471
# Conflicts:
#	docs/character_skeleton.md
2026-11-22 11:43:50 -05:00
4a3eb5de00 Merge pull request #2285 from YaBulochka
# Conflicts:
#	docs/design.md
2026-11-22 11:43:48 -05:00
0774991634 Merge pull request #2277 from Jose M Pahino
# Conflicts:
#	docs/README.md
#	docs/i18n/README.md
#	docs/i18n/es/quickstart.md
2026-11-22 11:43:43 -05:00
72758b9c5b Merge pull request #2270 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 11:43:39 -05:00
5478735d0b rdna2spirv: implement v_frexp_mant_f64 and v_frexp_exp_i32_f64 2026-11-22 17:43:36 +01:00
18ac14c932 Merge pull request #2268 from Kacper Serewis 2026-11-22 11:43:36 -05:00
4c28f269ec Merge pull request #2264 from SirAmong 2026-11-22 11:43:34 -05:00
23ee18b771 Merge pull request #2261 from S1m0ne1997 2026-11-22 11:43:33 -05:00