Commit Graph

5744 Commits

Author SHA1 Message Date
0a20f3c2df rdna2spirv: implement v_rcp_f64, v_rsq_f64 and v_sqrt_f64 with VOP3 modifiers 2026-11-22 17:27:19 +01:00
7e3ceb81b2 fix(shader): translate constant 64-bit vector compares
The GFX10 true and false predicates depend only on the incoming EXEC mask. Reuse the comparison destination logic so register pairs and NaN operands preserve the same lane semantics as narrower forms.
2026-11-22 17:26:52 +01:00
b9a3cbcfc0 gameinput: GetTemporalReading stays E_NOTIMPL, as in GameInput v0 (RT-147)
Microsoft's reference page says IGameInput::GetTemporalReading "was never
implemented in v0" and returns E_NOTIMPL, and v1 removed it, so the shim's
E_NOTIMPL already matches the API the title was built against. A history
lookup would answer what no GameInput runtime does. The v0 header (NuGet
Microsoft.GameInput 0.2303.22621.3038) declares (timestamp, device,
reading), the shim's layout; the page's five-parameter form doesn't match it.

Pin the behaviour in gameinput_test (E_NOTIMPL with the reading cleared, for
past, present and current timestamps, with and without a device filter;
E_POINTER for a null output) and say so in docs/gameinput.md instead of
listing the method as a gap.
2026-11-22 10:26:34 -06:00
0630bdfae2 docs: add the German (de) community quickstart
Translates the stable onboarding text (what the project is, own-copy and
no-game-data rules, prerequisites, build commands, stage order, common
problems, how to help) into German, following the structure of the other
quickstarts. Synced with 4eb6155d. Adds the de row to docs/i18n/README.md
and the language list in docs/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:26:18 +01:00
a217b88d8f tools: gamedata_reader, a streaming reader for the game-data XML that dispatches on root and type (ASSET-139)
Converts RAGE parser XML into plain values by its conventions (value,
x/y/z/w, content arrays, polymorphic type and NULL, ref, Item lists and
keyed maps, extra attributes), with register_root / register_type for
typed handlers. Each top-level field is converted and dropped as it ends.
On the 1.0.2.1 carve of common.rpf: 259 of 267 documents, 111 roots, 317
type classes, 0 conversion errors (counts only). Synthetic tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:26:13 +01:00
d20369eed8 TEST-319: corpus census in docs/design.md; the corpus GS are wave64, not wave32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:53 -05:00
b1e53ba47a docs: add Spanish (es) community quickstart 2026-11-22 17:24:48 +01:00
03b38d8419 TEST-319: an RX 580 (one subgroup size, 64) is the 64-lane reference; all 24 fixtures checked on an RTX 5070 against it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:24:13 -05:00
a843b69bf3 docs: no authored clothing colour exists in the garment data 2026-11-22 16:24:06 +00:00
c8cb0aa0a8 docs: record the raw-RSC body scan negative 2026-11-22 16:23:21 +00:00
c3c6a9a823 docs(design): merge duplicate Integer clamp contract rows into one
Resolves #2134. Merge the duplicate consecutive Integer clamp rows added in d9fb51b7 into one canonical row per the contract table rules, preserving RDNA2 hardware evidence and carry-out saturation behavior.

AI-assisted.
2026-11-22 17:22:07 +01:00
c6067f0942 rdna2spirv: v_sin/v_cos give +0 at odd half/quarter turns, as RDNA2 does (SHADER-134)
Measured natively on gfx1036 (f32 and f16, every quarter turn from 0.25 to
2^24 of either sign, around +-256, specials): sin at an odd half turn and
cos at an odd quarter turn are exactly +0, where Sin/Cos of the rounded
2*pi gave about -+8.7e-8 (or a 1-ulp f16 denormal). The test holds 500
measured words (whole, half and quarter turns, infinities, NaN).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:20:18 +01:00
3fa378b15d image_d16_probe: measure d16 integer image loads on 1D, 2D-array and 3D (SHADER-387)
A hardware-oracle probe that reads 32-bit UINT/SINT texels (one and two channels) with d16 image_load and
image_load_mip on SQ_RSRC_IMG_1D, 2D, 2D_ARRAY and 3D, and compares each result with truncation and with
unsigned/signed saturation. Native gfx1036 saturates on every dimension and form, as the translator does;
docs/design.md and docs/shader_validation.md record it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:20:14 +01:00
804f4aeff7 rdna2spirv, lane_masks: fix wave64 split SGPR-pair masks, emulate x_mcache, and b64 mask+imm tracking 2026-11-22 08:19:56 -08:00
d78546fc92 rdna2spirv: apply the SDWA src_sel to an f16 inline float constant
In an f16 SDWA op, Gen.src_h returned a float inline constant as its f16
bits without the operand's src_sel. On RDNA2 the constant is the f16 value
over a zero high half and src_sel then narrows it like a register:
v_add_f16_sdwa d, 1.0, v src0_sel:WORD_1 reads +0.0 (measured on gfx1036).
The translator added 1.0.

GPU test ps_sdwa_f16_const (hand-derived words, measured on gfx1036) with a
semantic fixture; it also covers an SGPR source and the integer path
(v_cvt_f16_u16_sdwa of 1.0), which were already right. docs/design.md row.

AI-assisted.
2026-11-22 17:17:54 +01:00
e30b405bbd 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:17:40 +01:00
b745f93946 anim_glb: export a skinned part with its skeleton and clips as an animated GLB
tools/anim_glb.py reads a fragment's skeleton (drawable +0x18: bone records,
inverse bind matrices, parents), binds part meshes to it through the model
bone list at grmModel+0x28 (ASSET-12 skin layouts), and writes decoded
anim.rpf clips as glTF animations: bonerotation/bonetranslation/bonescale
drive the joint with the track's bone hash, bone hash 0 drives a mover node,
and a clip entry maps animation time t to (t - start) / rate. --coverage
counts how many clip bone tracks name a skeleton joint.

docs/character_skeleton.md: the instance table was read 0x40 bytes late, so
each row paired a bone with the next bone's TRS. Read from the record start,
the default transforms compose to the stored inverse bind matrices (5.1e-6 m
female, 3.3e-6 m male, all 14,212 skeletons in packs.rpf within 1e-3). The
model bone list is at +0x28, not +0x20. New "Animated glTF export" section
with the measured counts; animation.md, models.md, character_models.md and
the docs index follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:17:37 +00:00
830a15d2c9 fix(shader): emit three-component volume gradients
Volume samples need all six derivative registers before XYZ and the optional LOD clamp. Reading four rejects plain samples and produces invalid Vulkan gradients for clamped samples.
2026-11-22 17:17:15 +01:00
74e39155f1 image_query_probe: measure image_get_resinfo and image_get_lod on RDNA2 (SHADER-388)
docs/design.md left resinfo's 2D depth word, the clamped LOD under a linear
mip filter and the u/v order of the LOD query unverified. The new probe runs
both instructions natively through tools/hw_oracle on hand-built GFX10
descriptors and compares every word with written rules. On gfx1036 all 614
results (wave32 and wave64) follow them:

- resinfo's 2D depth word is 0 (any WORD4 DEPTH); a 2D array's layer count
  is minified, max(1, layers >> (BASE_LEVEL + level)); past the last level
  width, height and depth are 0.
- get_lod's raw LOD includes LOD_BIAS; the clamped LOD is the clamp under a
  linear mip filter, the level read (half up) under point, 0 with none.
- u scales by the width, v by the height.

The translator still differs on the resinfo points; design.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:17:13 +01:00
13ac6d7e06 bvh.md: the leaf-frame rotation is one of 64 in pi/8 steps, not an axis-aligned one 2026-11-22 17:17:11 +01:00
db4be7ae6c tools/bvh_rehydrate.py: a CPU reference that rehydrates a dehydrated BLAS
Written from the packing in docs/bvh.md §4a, standard library only. Inputs are float3 vertices with uint16, uint32 or no indices, and an optional 3x4 geometry transform. It does the header copy, the leaf chunks (vertex-order slots, the paired fourth vertex), the box groups by level with their stored overrides, BOX16 outward rounding with the +-inf overflow, the parent entries and the compressionParams leaf frame. Float arithmetic is rounded to float32 per operation. On the 8 measured samples whose geometry is identified, the output is byte-identical to XboxBvhBuilder.dll's RehydrateRaytracingAccelerationStructureX (checked locally; no sample is in the repository). The 15 tests in tests/test_bvh_rehydrate.py are synthetic. docs/bvh.md §7 documents it, including the console's size convention, 64 * (totalSizeIn64BNodes + 1) bytes, which xdxr_bvh.py validate reads as one unit less.
2026-11-22 17:17:01 +01:00
a53434ca90 Docs: the runtime's device enables the optional pixel-shader features too 2026-11-22 12:16:42 -04:00
9a6add98e8 hw_oracle: native RDNA2 measurement of MODE.FP_ROUND f16/f64 (SHADER-132) 2026-11-22 17:16:34 +01:00
f9a12b7a71 rdna2spirv: typed buffer f32->f16 rounds toward zero and saturates, as RDNA2 does (SHADER-358)
Measured natively on gfx1036 (wave32 and wave64): stores into 16_FLOAT,
16_16_FLOAT and 16_16_16_16_FLOAT and d16 loads from 32-bit float formats
round toward zero, give +-65504 for a finite value past the range, flush
f32 denormals and keep a NaN's top payload bits without quieting it. The
translator rounded to nearest even and overflowed to infinity. UNORM/SNORM
d16 loads stay nearest even (re-measured). The new test holds 45 measured
values in four forms; the old float tie case asserted the unmeasured rule
and now holds the measured words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:14:09 +01:00
1a40ad22e1 Merge branch 'perf/wave64-emulate-dead-scc-exec-fold' into perf/wave64-emulate-structured
# Conflicts:
#	docs/design.md
2026-11-22 12:13:38 -04:00
fc52e96723 Tests: let focused GPU runs require a pass (TEST-364) 2026-11-22 17:13:19 +01:00
ecc6bd286e rdna2spirv: a 16-bit SDWA result with dst_sel:DWORD zeroes the high half
A 16-bit op in SDWA form (f16 VOP1/VOP2, v_cvt_u16/i16_f16, v_cvt_f16_u16/i16)
with dst_sel:DWORD writes the result zero-extended on RDNA2, whatever
dst_unused says. Gen.insn only marked an SDWA destination for a dst_sel other
than DWORD, so write_lo16 applied the non-SDWA keep-the-high-half rule and the
translator returned 0xdead4000 where gfx1036 returns 0x00004000.

Mark every SDWA VGPR destination and let write_lo16 skip the keep for it.
ps_sdwa_dword_hi.asm (GPU) and its semantic fixture pin four ops and three
dst_unused values; docs/design.md gets the contract row.

AI-assisted.
2026-11-22 17:13:04 +01:00
99bdb70ac9 hw_oracle: native RDNA2 measurement of ds_permute_b32 (SHADER-133) 2026-11-22 17:12:31 +01:00
b2497541e6 Merge remote-tracking branch 'origin/main' into perf/wave64-emulate-dead-scc-exec-fold
# Conflicts:
#	docs/design.md
2026-11-22 12:11:36 -04:00
9bf0794813 PresentX planes: review fixes (resize, struct order, overlay flag, ResourceCount)
- Re-prepare the compose target after the acquire/out-of-date retry and check the extent in
  record_planes; xbox_present_test resizes the window between composed presents.
- XboxPresentPlaneParameters follows the public field order exactly (adds ExtendedDescCount,
  pExtendedDescs); implausible placement / unknown filter / extended descs are ignored and
  logged once, not refused.
- Plane 1 is composed only with our overlay flag (SDR/SDR no longer blends by default).
- present_planes rejects a non-positive or NaN SDR white level.
- ResourceCount != 1 is refused with DXGI_ERROR_UNSUPPORTED before either path (found by Flyander).
- Docs: PQ-space filtering, HDR10 swapchain verified on RTX 5080 by JavierBlanco23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:11:01 +01:00
3ff74e8d58 gameinput: the keyboard pad's right stick reads raw mouse input and keeps the cursor in the window
GetCursorPos deltas stop at the screen edge and include pointer
acceleration. A message-only window on its own thread now registers for
raw mouse input (RIDEV_INPUTSINK) and sums the relative counts; the poll
takes the difference of that total. Absolute reports are ignored, and
GetCursorPos stays as the fallback if registration fails.

With raw input on and a window of this process in the foreground, the
cursor is clipped to that window's client area (re-applied every 100 ms),
and released on focus loss or when the pad is turned off.

LEONIDA_MOUSE_SENSITIVITY (0.1..10, default 1) scales the axis units per
count.
2026-11-22 18:09:44 +02:00
9cc95bff0d Runtime: GetCachedBlob and CachedPSO checks like the host runtime
ID3D12PipelineState::GetCachedBlob returns a blob with the adapter, driver, pipelineCacheUUID and a SHA-256 of the description (without Flags; shaders keyed by their DXBC checksum), sealed by a checksum. Create{Compute,Graphics}PipelineState check a supplied CachedPSO before creating the PSO and answer as the PC runtime does, measured on an RTX 3060 and WARP. Rebased onto main (one commit). AI-assisted.
2026-11-22 17:09:44 +01:00
a362bfe072 feat(shader): query texture LOD from packed half coordinates
GFX10 packs both 2D coordinates in the first address VGPR when A16 is set. Unpacking that word lets pixel shaders query mip selection with the same f32 result components used by full-precision queries.
2026-11-22 17:09:03 +01:00
30b763cb26 rdna2spirv: verify and support v_pack_b32_f16 abs/neg modifiers on RDNA2 (gfx1036) 2026-11-22 19:07:39 +03:00
0ead0a6030 rdna2spirv: single-rounded UNORM/SNORM stores and 2-comp DST_SEL swizzle (SHADER-364) 2026-11-22 17:07:27 +01:00
b76c78acdb Runtime: a bundle's draws run with the parent's state, and what the bundle set stays on the parent
A draw recorded in a bundle took the bundle's own viewport, targets, root
arguments and buffers. A bundle cannot set a viewport, so every bundle draw
was dropped without an error, and nothing of the parent's state reached it.
Only the stencil reference and the blend factor were handed back.

Inside a bundle, state calls, draws and Dispatch are now kept as deferred
calls, and ExecuteBundle plays them on the parent through the members a
direct call uses, between the bundle's state-free commands, in order. A
draw sees the parent's state plus what the bundle set, and what the bundle
set stays on the parent, as measured on the PC runtime. This replaces the
stencil-reference and blend-factor carry-back fields. Trace lines are
written once, when the bundle records the call.

ClearUnorderedAccessView is refused in a bundle, like the other clears.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:06:44 +07:00
00f04d1fb0 docs: clarify Linux diagnostics and runtime setup in pt-BR
Translate the stable Linux paths for Vulkan diagnostics, cross-building the Windows runtime with xwin, and reusing a runtime-windows artifact under Wine or Proton.

AI-assisted.
2026-11-22 13:06:30 -03:00
f0ea562d90 rdna2spirv: v_cvt_flr_i32_f32 of a negative denormal is 0, as on RDNA2 with f32 denormals flushed
Floor of the kept denormal gave -1. 44 more measured words (gfx1036) for
v_cvt_flr_i32_f32 and v_cvt_rpi_i32_f32 (the control) in the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:04:58 +01:00
c362d98eeb shader_validation: first RDNA2 (gfx1036) runs of the LDS and image hardware oracles (PROC-111)
lds_fuzz --oracle hw: default and --extended, seeds 1-3, 0 mismatches; the
masked ds_swizzle_b32 reads 0 from an off source lane on RDNA2 too
(SHADER-207). image_fuzz --oracle hw: 7,200 cases on the GFX10 T# layout,
0 mismatches. Negative controls caught every wrong model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:04:34 +01:00
395dee8759 text_tables: a resource's first stream may be any whole number of 64 KiB blocks
_chains joined the next stream only when the previous one was exactly BLOCK (65,536 bytes). But a
resource's first stream can be 128 or 192 KiB (docs/page_directory.md shows one ending at 0x20000 that
the next stream continues), and its string-table descriptors then end in the following stream. On my
1.0.2.1 copy, 41 data.rpf resources start with a 131,072- or 196,608-byte stream: 20 of their tables
were refused as out of range and 21 lost entries through the at + 8 > len(buf) skip. A stream now
continues a previous one whose size is a nonzero multiple of BLOCK.

Real data (counts only): data.rpf 14,440 -> 14,482 tables and 4,118,181 -> 4,197,518 strings, the same
from the archive and from an rpf9_carve folder; shared_minigame000.rpf unchanged (78 tables, 22,371
strings). docs/text.md updated.

Tests: test_resource_across_a_128k_first_stream and
test_whole_block_streams_continue_and_others_end_the_chain (main: the 128/192 KiB cases fail).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:04:06 -03:00
fd2050071a 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:03:34 +03:00
0399bb3d3c docs: describe the --limit resource-start boundary 2026-11-22 21:33:01 +05:30
d8c9fdfd5b fix(shader): read a null lane-mask source as zero
The GFX10 null register reads as zero. Applying that rule in the shared mask reader lets bit tests, reductions and saveexec accept the same source as a scalar data read.
2026-11-22 17:02:24 +01:00
3b548ca066 docs: record the second female cutscene base and the adult-actor negative 2026-11-22 16:02:08 +00:00
ce7a34850e SHADER-309: bounds-check LDS past the RSRC2 allocation
RDNA2 LDS does not wrap: an access outside the allocation reads 0 and
its write is dropped (ISA 3.6.1, 3.6.6). The wrapped array aliased such
an access onto a valid word (review on #1882). When a program's
constant offsets reach past its RSRC2 allocation, or the array is shrunk
to fit the cap, the array is now the allocation and Gen.lds_access
checks every dword of every LDS access kind (reads, writes, sub-dword,
read2/write2, atomics, cmpst, wrxchg): out of range a read or an
atomic's old value is 0 and the write is skipped. Other shaders keep
the wrapped power-of-two array with no check. The constant-offset need
is now exact (offset + access width) instead of offset + 4 dwords.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:01:45 +01:00
4f574add4b d3d12_descriptor_test: the bindless capacity check follows the set's room
On MoltenVK (1.4.2, 1.4.3) the check sampled zeros: vkGetDescriptorSetLayoutSupport there accepts only layouts
of fewer than maxPerSetDescriptors (1212) descriptors, so size_bindings keeps the default 4096 2D images and
1024 samplers, and the test's 5001st view and 2100th sampler were refused as the arrays filled. MoltenVK does
create and sample a 65536-image, 4096-sampler set correctly (a native reproduction, and the whole test passes
under Wine with growth forced), so that is MoltenVK's to fix; the runtime keeps following the driver's answer.

The test now asks the set how much room it has (rt::d3d12::bindless_room, from BindlessSet::free_images and
free_samplers). Where the set holds the full counts nothing changes. Where it holds fewer, the test fills each
short array to its last index, checks the last view through the last sampler gives the texture, and that one
more view and sampler are refused and read as the fallbacks. The device logs at startup when its set holds
fewer samplers than a full shader-visible sampler heap. bindless_sizing_test gets MoltenVK's limits;
vk_bindless_test checks the free counts.
2026-11-22 20:01:37 +04:00
1538abe44d rpf9_carve: list each unread range with its offset, size and entropy
docs/rpf.md said unread bytes "are recorded as a range", but the carve
only wrote the totals. The gap accounting, repeated before a Bink
stream, before a zlib stream and for the tail, moves into one helper.
It also appends every gap that is not all zero bytes to a top-level
`unread` list in index.json: off, size, and the Shannon entropy in
bits/byte of its first 1 MiB (`sampled`). summary.unread_ranges is the
count. Totals are unchanged; zero padding is not listed.

Measured on data.rpf: the same 20,268,240 unread bytes are 377 ranges;
278 of them (18,257,882 bytes, 90%) are at 7.5 bits/byte or more.
Counts only, in docs/rpf.md.

tests/test_rpf9_carve.py: ranges match the layout and the totals, a
uniform gap has entropy 0, a mostly-zero gap is one range, all-zero
gaps list nothing, and a range over 1 MiB samples its first MiB.
2026-11-22 13:01:32 -03:00
9905e77b42 docs: record the bodyupper and fragment-child negatives 2026-11-22 16:00:45 +00:00
5885e160e8 tools: sdwa_diff.py, a differential fuzzer for the SDWA VALU forms
A separate reference for 92 _sdwa VOP1/VOP2/VOPC opcodes (integer and f16
families: source selects, sext(), dst_sel with dst_unused PAD/SEXT/PRESERVE,
SGPR and inline-constant sources, clamp, f16 neg/abs) compared with
rdna2spirv + spirv_mini_interp on seeded one-lane programs, in the style of
salu_diff.py. --oracle hw runs the programs on an RDNA1/RDNA2 GPU; every rule
of the reference was checked on gfx1036. Forms where the translator is known
to differ are left out unless --known.

AI-assisted.
2026-11-22 16:59:29 +01:00
849f4b7a9c d3d12: reject integer formats in plain resolves (D3D-274)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-22 16:59:20 +01:00