Commit Graph

5744 Commits

Author SHA1 Message Date
69a8cf66e1 docs: add Intel and RTX 5070 Ti descriptor benchmarks 2026-11-22 11:39:12 +00:00
017d260438 fix(runtime): bind single-layer Texture1D shader-resource views
The device can allocate 1D textures and set 0 has a sampled 1D binding, but default and explicit views previously sampled the fallback. Use the texture dimension and the requested mip range when registering the view.
2026-11-22 12:38:59 +01:00
c12368e701 Merge pull request #1472 from Dominik 2026-11-22 06:38:11 -05:00
fd2865746e Merge pull request #1471 from Luiz Neves 2026-11-22 06:38:11 -05:00
9b3f8388b9 Merge pull request #1470 from CLHelper 2026-11-22 06:38:11 -05:00
e948729a25 Merge pull request #1469 from CLHelper 2026-11-22 06:38:11 -05:00
c7fc131b41 Merge pull request #1465 from Lucy 2026-11-22 06:38:10 -05:00
38b7b9a663 Merge pull request #1461 from Vonsek 2026-11-22 06:38:09 -05:00
d9b9b002bf Merge pull request #1449 from Kam471 2026-11-22 06:38:06 -05:00
5c9e9838b0 Merge pull request #1442 from Vonsek 2026-11-22 06:38:05 -05:00
f46122112f Merge pull request #1439 from Lucy 2026-11-22 06:38:04 -05:00
807d1ac8dd Merge pull request #1437 from Lucy 2026-11-22 06:38:04 -05:00
addb56822e Merge pull request #1436 from guichy12
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 06:38:03 -05:00
fba4605513 audio: use the format block's per-channel Opus frame count (+0x0C)
The format block carries the per-channel count at +0x0C: equal to +0 for mono
and half of it for stereo in 7,451 measured streams (0 mismatches), matching
rpf9-explorer's OpusFrameCountPerChannel. Use it (with +0/channels as fallback)
instead of inferring the division, and document the field.
2026-11-22 11:38:02 +00:00
0b6e9952d4 Merge pull request #1432 from Emre Demir 2026-11-22 06:38:02 -05:00
48b8b5d11d Merge pull request #1427 from abilliontokens 2026-11-22 06:38:01 -05:00
db83d7a707 Merge pull request #1424 from Ryderadzeee 2026-11-22 06:38:00 -05:00
a9ada3bfd4 Merge pull request #1421 from Nikolas Sturm 2026-11-22 06:38:00 -05:00
05446c6357 Docs: check Windows ROCm llvm-mc support for TEST-71 f16 programs 2026-11-22 12:37:58 +01:00
12b044c336 Merge pull request #1413 from Ewann 2026-11-22 06:37:57 -05:00
956d2af216 Merge pull request #1411 from Ewann 2026-11-22 06:37:57 -05:00
f4e0f706e1 Merge pull request #1407 from Hamza 2026-11-22 06:37:56 -05:00
923993c1c7 Merge pull request #1405 from Vonsek 2026-11-22 06:37:55 -05:00
793787a5d8 Merge pull request #1376 from Jolymmiles 2026-11-22 06:37:54 -05:00
650ea999a6 Merge pull request #1083 from abilliontokens 2026-11-22 06:37:53 -05:00
faa57e52ad bvh_builder_test: use WARP on every hardware vendor by default (RT-89)
RT-54 switched to WARP only on NVIDIA (PCI vendor 0x10DE). AMD faults the same way: on an RX 7900 XTX the
XboxBvhBuilder constructor ends with 0xC0000005 right after the first slot 62 call (found by
@ThatZaliaSGuy, #166). The test now uses WARP whenever there is a hardware adapter, prints the vendor id it
skipped, and LEONIDA_BVH_HARDWARE=1 still keeps the hardware device. docs/d3d12_vulkan.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:36:34 +00:00
f4567aa22c rdna2spirv: s_nand_b64, s_nor_b64 and s_xnor_b64
The other 64-bit scalar bitwise ops were translated, these three were
rejected. They join the s_and_b64 branch: D = ~(S0 op S1) on the
lane-mask path (a lane's mask value is 0 or ~0, so the NOT is per lane)
and on both dwords of 64-bit data, SCC as for the others.

test_salu64_bitwise_data.py runs them through its data cases (distinct
dwords, four-corner SCC, immediates, null, aliasing) and the wave32 and
wave64 lane-mask cases. docs/design.md row updated.
2026-11-22 08:35:59 -03:00
40f239be13 M2: pipelines bind the bindless set 0; textured quad through the descriptor path (d3d12_m2_textured_test)
Pipelines (graphics and compute) whose translated shader declares set-0 bindings were refused. Their layout now
holds the device's bindless set 0 and replay binds it at every draw and dispatch. d3d12_m2_textured_test drives
heaps, SRVs, a POINT sampler, two root descriptor tables and DrawIndexedInstanced with a translated PS that
loads the T#/S# from the tables; 4096 of 4096 pixels match, and the descriptor hash table is checked.
d3d12_translated_draw_test is registered with ctest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:34:41 +01:00
e1b3fca96d Runtime: depth <-> colour copies through a scratch buffer
CopyResource and CopyTextureRegion between D32_FLOAT and R32_FLOAT/UINT/SINT,
and between D16_UNORM and R16_FLOAT/UNORM, were refused at execution because
vkCmdCopyImage cannot mix a depth and a colour aspect. Host D3D12 and WARP
copy the bits, and #1134 listed these as not covered.

The replay now stages each such region image -> scratch buffer -> image.
The scratch comes from a new ScratchBuffers pool (vulkan_scratch.h):
device-local chunks handed out while a list is prepared and retired with
the submission's timeline value, like the depth24 converter's scratch, but
enabled on every GPU. Without it the copy is refused as unsupported before
anything is written.

Still refused: depth with stencil (two planes), D24 stored as D32, and
multisampled textures.

Tests: d3d12_copy_xfmt gains five depth <-> colour cases (R16 -> D16 both
ways, D32 -> R32_UINT, three mips, and a D32 -> R16 negative control), and a
depth <-> colour mismatch now fails it. vk_command_replay_test part H runs a
D32 -> R32 -> D32 round trip through the replay, and checks that a list is
refused with no scratch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:33:50 +02:00
449cb7b460 fuzzers: skip wave32 runs vk_compute_test could not pin to 32 lanes
valu_fuzz.py, lds_fuzz.py and crosslane_fuzz.py ask vk_compute_test for
32-lane subgroups (VKC_SUBGROUP_SIZE=32) for wave32 programs, but they
ignored its "compute subgroup size: 32 not available" line. On a device
that can't pin that size (Mesa llvmpipe: 8 lanes) every wave32 program
was judged at the driver's size and its cross-lane results came out as
translator mismatches. On main f85582e with llvmpipe, lds_fuzz --emulate
--programs 400 --seed 5150 gave 215 mismatches, all wave32, and
crosslane_fuzz --wave 32 --no-maskdata gave 68 of 100.

Those wave32 programs are now skips, as check.py's unpinned_subgroup_skip
does for its lane-mask dumps. Programs translated with --wave64-emulate
use no subgroup operations, so they are still compared at any size
(400 of 400 match on llvmpipe). crosslane_fuzz counts the skips in its
summary and exits 2 when every program was skipped, as the other two
fuzzers already do.

The line is parsed by compute_fixture.unpinned_subgroup, shared by the
three fuzzers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:33:45 +00:00
5d32ddb7f4 Docs: textures.rpf header variants, say only what was seen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:33:22 +00:00
7149907c8f Docs: what textures.rpf holds
rpf9_carve over textures.rpf: 2,749 streams; 1,313 system/graphics page pairs
of one two-texture dictionary template (128x128, format code 0x5f, payload
exactly 2 x 16,384 bytes) with 1,117 distinct payloads, and 121 opaque raw
streams holding 91% of the inflated bytes. Counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:33:14 +00:00
1681f3dc1e Translator: --f16-interp-fallback reads f16 halves without PerVertexKHR (SHADER-196)
MoltenVK can't compile PerVertexKHR to MSL, so ps_interp_f16_high failed at
pipeline creation on every Mac. With --f16-interp-fallback every VS/mesh param
(and the --mesh-compute VS) also exports its two f16 halves decoded to f32,
low halves at location 29 - 2N and high halves at 30 - 2N, and a PS *_f16 read
takes them as ordinary smooth inputs. A producer skips halves that would land
on its own params; a PS whose half location is also an attribute is rejected.
The index records f16_halves on both sides.

tools/vk_subgroup_info.py reports per_vertex_inputs (false without
fragmentShaderBarycentric or on MoltenVK); make_game.py and run_gpu_tests.py
turn the flag on where it is false. Without the flag all 139 GPU-test modules
are byte-identical to main's, so NVIDIA/AMD keep the exact per-vertex path.

Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_interp_f16_high passes, all
4096 pixels bit-exact; run_gpu_tests.py 84 pass/50 skip/1 fail -> 85/50/0
native, 112/22/1 -> 113/22/0 with wave64 emulation; ms_f16_pack passes through
--mesh-compute. Semantic suite 1194 -> 1203 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
2026-11-22 14:32:28 +03:00
5e91fb9af2 Merge main into test-184-image-ops
main is at bb2e1842. Three conflicts, both sides kept:

- runtime/test/vk_store_test.cpp: main added the "load-d16" mode (a row of
  16-bit boundary values in the fill, for the saturating d16 loads) and
  VK_KHR_shader_fma support; this branch added the "words" mode. Both modes
  and both includes stay; main's boundary row applies to "load-d16" only, so
  "words" keeps the plain fill its expected words are derived from.
- runtime/test/shaders/check.py: main lengthened CS_STORE on the line next to
  this branch's cs_bvh32 entry. Both lines.
- tests/test_shader_checks.py: main counts cs_fma_fused (8 -> 9) on the line
  after this branch's STORE_WORDS and GET_LOD_TESTS terms. Both.

The automatic merges were read as well: vk_compute_test.cpp keeps the larger
bvh heap next to main's shader_fma code, and check.py and run_gpu_tests.py
run cs_imgload_d16 in "load-d16" next to the "words" fixtures.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 06:31:49 -05:00
73552dfcd3 audio: write the Opus pre-skip and correct plain-stream lengths (ASSET-104)
OpusHead declared pre-skip 0, so every exported stream started with 312
samples of libopus priming and the end trim removed the same amount of real
audio. Write the lookahead (312 by default, --pre-skip overrides it) and make
the trimmed final granule pre_skip + length.

The plain-stream length also scaled the format tag's sample count by
48000/rate and ignored stereo interleaving. Measured over 1,598,151 plain
streams: packet samples - declared is 1920..2879 for every 48 kHz and 32 kHz
stream, which is only possible if the declared count is already 48 kHz frames;
after halving stereo counts the same 1920..2879 window holds for all 17,983
stereo streams. Scaling a 32 kHz stream by 1.5 left the padding untrimmed.

Tests cover the pre-skip, the 48 kHz frame count, stereo halving and the
--pre-skip bounds. libopus round-trip: the fixed output matches the reference
Ogg sample-for-sample (max |diff| 0); before the fix it was shifted 312
samples and differed by up to 12,188.
2026-11-22 11:31:02 +00:00
6c44492e33 fix(shader): saturate UINT formatted buffer stores
Narrowing a channel to an eight- or sixteen-bit UINT field must clamp high values before packing. Native RDNA2 returns all ones for an overflowing field, while masking wrapped it to the low bits.
2026-11-22 12:30:54 +01:00
ba4687404d Merge origin/main (bb2e1842) into d3d90-castable-placed
Third merge round (118 commits): D3D-97's per-queue priorities keep the
GPU address arena's bufferDeviceAddress enable; main's VK_KHR_shader_fma
probing chains after the PR's PSO feature enables; the backing-offset and
hardened whole-buffer-copy refactors replace the PR's older lines.
2026-11-22 03:30:40 -08:00
f3d302dded docs: per-thread TLS and C++ exceptions in mapped images
runtime/README.md: the RtlPcToFileHeader redirect, and the thread events in
place of "the loader does not deliver thread attach/detach events"; mapped
DLLs' DllMain still gets no thread events. design.md: the CPU-code row.
2026-11-22 12:29:52 +01:00
1387865c3a merge: cover wide sample inputs after D16 saturation reaches main
Use the current common image packer and its boundary-value fixture for the sample shader. Keep the merged explicit-gather paths and the headless presentation skip.
2026-11-22 12:29:49 +01:00
85cb97ee42 fix(shader): saturate unsigned D16 buffer fetches
Native RDNA2 clamps 32-bit unsigned contents to the 16-bit range before packing both halves. Reuse the integer narrowing helper for MUBUF and MTBUF while preserving full-width fetches and the unused high half.
2026-11-22 12:27:12 +01:00
2b0ae9ebf8 Docs: CProceduralInfo tag table and its empty object/plant lists
The one CProceduralInfo document in common.rpf has a 255-slot procedural tag
table (107 names; one placeholder name fills 149 untagged slots) whose 66
procObj and 69 plant tags point into procObjInfos and plantInfos lists that
are both empty. No names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:41 +00:00
013cfb3966 tools: fma_mix_probe tells single from double f16 rounding of v_fma_mix
docs/design.md leaves one f16 question open: in round-to-nearest mode, does
v_fma_mixlo/hi_f16 round the exact x * y + z once to f16, or to f32 first
and then narrow? The translator does the second (f32 Fma, then f16_res).
The RX 6800 word behind the toward-zero rule can't settle it, because
1 * 2 - 2^-30 gives 0x4000 under both readings in nearest mode.

tools/fma_mix_probe.py has seven inputs where the two rules differ by one
f16 ulp, plus a control:
- ties just above and below, for both signs;
- the subnormal tie at 2^-25;
- the overflow tie at 65520;
- a tie made by the product;
- the same with f16 operands.
It reports which rule each side follows:
- the translator, on the CPU interpreter;
- --oracle hw: the native instruction on an AMD GPU, through
  tools/hw_oracle, under the game's inferred MODE;
- --oracle vulkan: the translated compute shader through vk_compute_test,
  with operands in user SGPRs so the driver can't fold them.

tests/test_fma_mix_probe.py checks:
- the expected words against a derivation written out by hand;
- that the translator follows the double rule today;
- that the compute listing gives the pixel shader's words;
- the verdict and exit codes.

On an RTX 5060 (621.24) the translated shader follows the translator's rule
on all eight inputs. A translator copy that uses fma_mix_odd in nearest mode
gives the single-rounded words on the CPU and on the GPU. That is the fix
if AMD hardware turns out to round once. The translator itself is unchanged.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:25:04 +02:00
932287398d docs: FSR DLL list slots 54/55/59/85, pipeline slot 11 and the device +0x18 copy switch
Static reading of the FSR DLL's call sites, added to section 3.5a:

- 54 is ClearUnorderedAccessViewFloat and 55 DiscardResource (both +4).
- 59 is one console slot with a bool first argument, used for both ends of a
  GPU event; the two slots the console lacks are among 56-60.
- 85 takes the six CopyTextureRegion arguments (two copy locations), not one
  pointer: buffer-to-texture with a footprint from device slot 38, or
  texture-to-texture.
- Pipeline slot 11 (console-only) gives a per-pipeline scratch value; the
  largest times 0xd0 sizes FFX_XBox_ComputeScratch, and slot 141's fourth
  argument is the bound pipeline's value.
- A byte at device +0x18 selects between the DLL's own 32-byte descriptor
  copy and device slot 24 CopyDescriptorsSimple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:24:15 +00:00
33ab1a1202 Docs: entity component sets and component LOD
Counts over CEntityComponentLodManagerData and the object, vehicle and ped
component-set managers in common.rpf: 33 component types with pool sizes;
every type used by the 7 vehicle and 15 ped sets (32 of 33) is in that list;
DefaultSet refs resolve; Min <= Max distance in all 263 components. No names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:23:55 +00:00
1babaf7f8a docs: record the FMA measurement in the contract row (SHADER-182)
Add the seed 330 v_fmac_f16 run on aa217aeb, 300681bb and KosmicKrisp,
make the KosmicKrisp command runnable as written, and reword the FMA
symptom.
2026-11-22 15:21:26 +04:00
7f97fb7b8f Merge fork/m15-translated-draw-v2 (M1.5, #907) into pr291-on-main 2026-11-22 12:19:59 +01:00
3162124c62 rsc8_audio: accept zero-stream ADAT banks (ASSET-105)
- parse_adat_header_bytes/parse_adat_at_file rejected count == 0 outright, so the validated
  walk missed audio.rpf's two 20-byte zero-stream banks that the encrypted TOC lists and
  AwcRecovery.ReadValidated accepts (docs said 7,160 banks vs design.md's 7,162).
- A zero-stream bank is now accepted only when the flag-selected tables end exactly at the
  declared header size; slop, truncation and out-of-bounds stay rejected.
- Three synthetic tests (no game bytes); docs/rsc8_audio.md corpus row updated to the
  re-measured 7,162 banks / 28,505,691,532 bytes with a note on the layout.
2026-11-22 03:18:52 -08:00
09b08df5d1 Support SINT and SNORM RTVs for typeless RGBA8 textures 2026-11-22 15:17:12 +04:00
bb7ad054f5 docs: drop stale duplicate CreateRenderTargetView/DepthStencilView line 2026-11-22 07:17:03 -04:00
d344fcb275 tools: name AWC streams from dictionary hits on their joaat ids
AWC stream tables keep only joaat(lowercase name) & 0x1FFFFFFF. With ~1.8M
distinct ids in a 2^29 space, ~0.3% of arbitrary words collide, so
awc_names.py accepts a hit only as an exact dialogue-wave word
(<root>au_<4 letters>_<NN>) or as a numbered family in one bank (3+
members or 2 adjacent, common-token base, one member a dictionary word).
A salted control run estimates the false names and sets each rule's
threshold per source.

The dictionary takes word lists or a hashdict.py JSON, and builds dialogue
wave names from conversation key/label pairs (<key>_01.._N per label).
Banks come from .awc files, directories or rpf9dump's audio_manifest.json.

On 1.0.2.1: 266,781 of 1.85M ids named (story000 73.7%, audio 5.7%),
with 417 control hits. Standard library only; tests are synthetic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:16:06 +01:00