Commit Graph

5744 Commits

Author SHA1 Message Date
5f6603cc01 Merge pull request #238 from Mokbul Miah 2026-11-22 04:37:47 -05:00
48496b96c1 d3d12: emulate R9G9B9E5_SHAREDEXP UAV textures with mutable R32_UINT 2026-11-22 06:37:10 -03:00
05b1dbdb10 d3d12: OPTIONS1 answers 16..16 lanes on Intel integrated GPUs like the host (D3D-121)
Intel's D3D12 driver reports a fixed WaveLaneCountMin/Max of 16 on its
integrated GPUs, where Vulkan reports the compiler's 8..32 range, so
compare_options1 failed on every Intel iGPU. Measured on Xe-LP: UHD 770
(32.0.101.6129) and Raptor Lake-S Mobile (101.7092). Discrete Arc keeps
the Vulkan range until TEST-57 measures it.
2026-11-22 12:37:02 +03:00
01074fea96 docs/testing: use GPU test binaries from the same commit as the scripts
Measured on Windows 11 build 26300 with the 426023a script against the
48ad23f runtime-windows artifact: 28 false cs_* failures on both an
RTX 5070 Ti Laptop and a Radeon 610M. Either matching pair (48ad23f
script and artifact, or 426023a script and artifact) is clean, so the
failures are version skew, not a translator or driver bug.

TEST-58/TEST-71 testers without a compiler are likely to use a CI
artifact; say which commit it belongs to and to check that commit out.

Docs only, no game data, no CI change.
2026-11-22 17:36:27 +08:00
7249dcb87d hw_oracle: build the launcher with MSVC when there is no MinGW gcc
find_cc() accepted only gcc, so a Windows contributor with Visual Studio (already required for the runtime)
got "hardware oracle unavailable: no MinGW gcc". hw_oracle.c builds cleanly with cl /O1.

- Order: LEONIDA_HOST_CC (gcc, or cl.exe / clang-cl), gcc on PATH or in C:\msys64, then on Windows a cl on
  PATH (Developer shell), then the Visual Studio vswhere finds, through its vcvars64.bat in a .cmd script.
- cl's objects go to the oracle's work folder, its errors (on stdout) reach the Unavailable message, and the
  temporary launcher name ends in .exe so cl doesn't append another one.
- Unit tests for the choice and the commands; docs/shader_validation.md says the runtime's VS is enough.

Checked end to end on an RX 9070 with no gcc and no cl on PATH: the launcher is built through vcvars64.bat,
salu_diff and crosslane_fuzz --oracle hw run with 0 mismatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:35:02 +00:00
18ebc2530d fix(shader): preserve vertex cull distances in barycentric helpers
A PS-only geometry helper cannot recover primitive culling from the fragment interface. Use the declared VS array for an explicit pair so fully negative primitives are discarded on the fallback path.
2026-11-22 10:32:31 +01:00
c69c6f76c6 fix(translator): fetch explicit 2D mips through typed sampled views
Fetching an integer view through a float OpTypeImage violates the Vulkan draw contract even on drivers that return the expected bits. Reuse the typed fetch selection and pass the guest mip register to each branch.
2026-11-22 10:29:38 +01:00
0206318f69 Test GPU query results driving predicated buffer copies against WARP
Resolve real empty ordinary/binary occlusion queries into default-heap predicates at two offsets and check both operators. Add GPU high-word-only overwrites, captured-value preservation, same-address recapture and reset controls. Compare all destination bytes and predicate guards with literal expectations and native WARP; four paired recapture controls change exactly one 13-byte region.

RX 5700 XT with Vulkan validation and synchronization validation: all 16 query-to-copy cases plus 180 existing cases passed, zero validation errors. Native WARP-only controls also passed. Coverage intentionally excludes nonzero visible-draw occlusion counts.
2026-11-22 05:28:28 -04:00
60e4d945ea Test predicated buffer copies with queue kinds and occlusion resolves
Verify compute and transfer readback-stage collection, descriptor cleanup after failed submits and gated/reused batches. Extend binary and overlapping occlusion fixtures with independent destinations to check skipped-copy preservation and copying after predicate reset. Document the command-slot lifetime and queue integration.

Local RX 5700 XT validation: 180 exact WARP comparisons, 64 gated/reused copy submissions, both occlusion controls, 192 predicate captures, replay A-G and 1663 existing WARP readbacks passed. CTest: 59/60 active tests passed; the six stencil CopyResource mismatch reports exactly match the tested #856 baseline. Shader source and embedded SPIR-V match after Vulkan 1.2 validation.
2026-11-22 05:28:28 -04:00
9360ec9ec0 Runtime: predicate byte-granular CopyBufferRegion on the GPU
Build on the full 64-bit predicate snapshots from #856. Replay predicated buffer copies through a storage8 compute helper, retain descriptor batches through timeline completion, and reject missing capabilities or active statistics queries before submitting work.

Validate byte offsets, high predicate words, bounds, skipped destinations and pending descriptor lifetimes with CPU checks, 180 native WARP comparisons and 64 gated/reused GPU submissions. The existing OPTIONS19 host-capability mismatch also reproduces on base 4a36bb1; no tests are disabled.
2026-11-22 05:28:28 -04:00
6e17ca8071 fix(shader): preserve the trailing VGPR half in packed buffer loads
The RDNA2 buffer unit updates only the addressed components even on an out-of-bounds load. Clearing the last high half clobbers unrelated values held across an x or xyz load.
2026-11-22 10:24:54 +01:00
4413912cd1 Merge origin/main (e7584c52) into interp-guards: second advance during verification
Main moved 426023a5 -> e7584c52 (10 PRs) while the first merge round was
being verified. Auto-merged clean; no overlap with the SHADER-177 guards.
Notable main-side additions kept: check_interpolation_modes() (#1239, an
orthogonal FSSM attribute-mode guard: it checks the attribute's declared
interpolation mode, ours checks the barycentric VGPR source), the new
tools/ps_interp_census.py, and further rdna2spirv changes (#1246, #1250,
#1253). Guards, copy-root tracking, and the #1214 high-half composition
are unchanged and re-verified against e7584c52.
2026-11-22 01:24:13 -08:00
5aa659ee0b Merge origin/main into interp-guards: compose with #1214's f16 high-half model
Conflicts resolved:
- tools/rdna2spirv.py: kept interp_pair_src ahead of the *_f16 interp's
  attribute() call and took main's attribute(..., half=...) with its
  PerVertexKHR docstring (quackottu's #1214 high model, on main as
  98f485f4): the I/J source guard and the high-half attribute read are
  orthogonal — the guard checks the barycentric VGPR source, `high`
  selects the attribute half. Both methods kept side by side.
- docs/design.md: kept our SHADER-177 contract row and main's updated
  Pixel-shader interpolants row (both rows; main's adds #1214's
  16-bit-interpolation parenthetical).

Also addresses review on #1224 (kapitche, Vonsek):
- per-op I/J roles: v_interp_p1* must read I (v0 or a copy rooted at v0),
  v_interp_p2* must read J (v1 or a copy rooted at v1); swapped
  p1(v1)/p2(v0) and both-v0 pairs are now refused. interp_copy_sources
  tracks each copy chain's root; refusals name the register and the role.
- copy-source provenance (Vonsek measurement row 3): a copy only
  qualifies while its source v0/v1 is itself unwritten up to the copy —
  a copy of an overwritten v0/v1 carries a computed value, not the pair;
  a write after the copy is fine (the copy saved the value; the corpus's
  one copy PS, 7PS_RasterizeWaterVolumeExposedSurface_d0369bb7, is
  exactly this shape and stays byte-identical).
- tests/semantic/test_interp_guards.py: 5 new tests mirroring the
  measurement rows and the role/root rules (now 14). Direct v0/v1 reads
  after an overwrite stay accepted — modelling that computed barycentric
  is the separate provenance follow-up (#1218).

Verified: semantic suite 1153 OK; 200-shader corpus slice 200/200
translated + spirv-val, all 419 output files byte-identical to current
main (426023a5); the copy PS byte-identical to main.
2026-11-22 01:15:18 -08:00
15966bb361 Docs: location, interior, river and road name lookup
Counts over the one GameShape__Data__LocationNameLoopkup document in
common.rpf: 2,318 locations, 1,358 interiors with 2,280 positions (all
inside the PAMH / region tint rectangle), 66 rivers, 409 roads; keys are
their own namespace. No names or keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:15:04 +00:00
8c20dd093d Translator: implement DPP16/DPP8 source selection
base_op stripped the _dpp suffix and the op ran as a plain move, so v_mov_b32_dpp quad_perm:[1,0,3,2] exported its own lane and still passed spirv-val. Implement the DPP16 controls (quad_perm, row_shl/shr/ror/share/xmask/mirror/half_mirror), DPP8 (dpp8 + fi), row/bank masks and bound_ctrl. A source lane that is out of range or inactive reads zero under bound_ctrl:1, otherwise the destination keeps its old value. Under --wave64-emulate the exchange goes through the workgroup buffer, like the other cross-lane ops. GPU-checked with cs_dpp*.asm on an RTX 3070.
2026-11-22 09:15:01 +00:00
a6a6326824 Docs: full-corpus component types of the 42 40 00 00 vertex streams
vertex_types.py over the seven archives with target blocks (60,442 dense
blocks, 138.9M vertices): header words constant, tag 0x28 is signed int16
pairs (85x fewer edge wraps than unsigned), tag 0x26 slot 1 has an
alpha-like byte 3, and none of 19 normal encodings explains tag 0x21.
Counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:13:49 +00:00
b68331d771 Tools+docs: decode PS interpolation modes from PSV0 and census the corpus (SHADER-181)
No FSSM word stores SPI_PS_INPUT_ENA/ADDR (u16 scan of 0x00-0x138 over all
12,101 PS against the signature-reconstructed value). tools/ps_interp_modes.py
decodes the mode from the DXBC PSV0 input elements (DXIL::InterpolationMode,
mapped to the SPI_PS_INPUT_ENA pair bits per Mesa gfx103.json), cross-checks
the FSSM table flags (read-method bits 0/1/3/4) and the disassembly I/J
operands, and runs a census: all generic inputs are Constant or
perspective-centre Linear (zero centroid/sample/noperspective); SV_Position is
noperspective by D3D rule, interpolated through the parameter cache in only 4
PS; every shader reads a single barycentric pair (v0/v1, one v14 copy). 23
synthetic tests; decoder+census only, no translator change.
2026-11-22 01:09:58 -08:00
17f39ac44f anim_clips: read .motion child times and one-axis parameter nodes
.motion +0x70 holds one 0x28-byte item per child: the child's duration, its
duration in the blend and a (child time, blend time) curve. On anim.rpf the
first float is bit-for-bit the named .clip's duration for all 111,948 children
that name a .clip there; 158,991 of 159,584 curves are the identity and 402 are
monotonic time warps.

The parameter node is at +0x138 (+0x58 = 1) or at +0x18 of the block +0x120
points at (+0x58 = 2). Type 3 (10,171 of 17,247) is one sampled axis: a name
hash, (sample index, value) items sorted by value, min and max. 10 of the 88
axis name hashes resolve to joaat32 names such as yawangle and speed.

Also documents that the unlisted-last-page recovery needs the page map in a
listed stream (whattheflop's review on #1174): no anim.rpf root and no
story000 clip dictionary has its page map in such a tail. A synthetic test
keeps that layout unresolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:08:55 +00:00
70b13bc600 Merge pull request #1251 from YaBulochka 2026-11-22 04:07:53 -05:00
8cd8206fef Merge pull request #1250 from pasindunaduninduwara 2026-11-22 04:07:53 -05:00
e78f607ea9 Merge pull request #1248 from AlxcBTW 2026-11-22 04:07:52 -05:00
f93fdc7314 Merge pull request #1246 from kotorvr
# Conflicts:
#	docs/design.md
2026-11-22 04:07:52 -05:00
201b37d0b6 Merge pull request #1239 from Vonsek 2026-11-22 04:07:49 -05:00
238b5883c6 Merge pull request #1237 from Lucy
# Conflicts:
#	docs/gamedata.md
2026-11-22 04:07:49 -05:00
cac87b289d Merge pull request #1233 from Nostyxx 2026-11-22 04:07:47 -05:00
1c3d41233c Merge pull request #1232 from Vonsek 2026-11-22 04:07:47 -05:00
4d94045fda Merge pull request #1229 from Kevin Morales 2026-11-22 04:07:46 -05:00
b75cca011c Merge pull request #1228 from Dominik 2026-11-22 04:07:46 -05:00
eddffb846d Merge pull request #1153 from ICUMADETHIS 2026-11-22 04:07:45 -05:00
22e6aec2a4 Merge pull request #856 from 73N1X 2026-11-22 04:07:44 -05:00
59fc644063 Merge remote-tracking branch 'origin/main' into shader-181-ps-interp
# Conflicts:
#	docs/design.md
2026-11-22 09:05:47 +00:00
b96c79ca4d rdna2spirv: honor VOP3 op_sel on 16-bit vector compares 2026-11-22 14:32:51 +05:30
b15c964f84 docs/testing: remove the duplicated skip sentence in the barycentric section 2026-11-22 12:02:50 +03:00
ee84578afe f32_fuzz hw: assembler rejections fail the run, hedge the omod finding, zero_inf probes
- own 'asm rej' column; any rejection outside the GFX11 table exits 2
- known deviation omod_neg_zero only where the omod was active
- omod wording/citations (SIFoldOperands.cpp, D30209), v_min_legacy_f32 is in no GFX10/11 part
- zero_inf probes so the DX9-multiply negative control is caught at small sizes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:00:49 +01:00
c3123e33b4 shader: decode PS interpolation modes; refuse modes the translator doesn't model (SHADER-181)
The FSSM pixel-input record's flags bits 0-1 hold the interpolation mode
(1 flat, 2 linear = perspective-center). Over the 12,101 PS of the 1.0.2.1
corpus they are 1 or 2 only, agree with the v_interp form the code uses in
every shader, and match PSV0's per-input InterpolationMode (linear or
constant; no centroid, sample or noperspective input). The FSSM holds no
SPI_PS_INPUT_ENA/ADDR word.

- fssm_header: interpolation_modes(), mode names, tally of PS modes.
- rdna2spirv: check_interpolation_modes() refuses a read position whose
  mode disagrees or is 0/3 (rejects 0 of 12,101 PS; shard 0/12 output is
  byte-identical to main).
- ps_interp_census.py: PSV0 + FSSM + disassembly census (stdlib).
- docs/design.md: contract row with method and counts.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:00:29 +00:00
b87dca6e54 docs: f32_fuzz hardware oracle results, GFX11 handling, omod finding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:55:00 +01:00
4f7aeb8d4d Merge main 426023a5 into #753 2026-11-22 09:53:47 +01:00
8163c74be5 Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts) 2026-11-22 00:52:00 -08:00
759087b51b Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
- register_samplers (main) and create_window_presenter (stack) both kept.
- Resource dtor: stack arena release + main deferred destroys.
- AS binding: main size/host_readable + stack console va.
- VulkanContext: main's lock split kept; stack arena/pipeline accessors
  moved to resource_mutex_ (execute copies replay_ under its shared lock),
  presenter lookups take it shared.
- README takes main wholesale; D3D-90 code and tests untouched.
2026-11-22 00:51:55 -08:00
94a29af1fd fix(shader): preserve clip distances in paired barycentric helpers
A geometry shader becomes the last stage before clipping and must forward the producing vertex shader's clip array. Key an explicitly paired helper by the array length so distinct pipelines retain independent clip layouts.
2026-11-22 09:50:42 +01:00
70178d307c Merge main (426023a) into runtime/compute-path 2026-11-22 05:50:30 -03:00
68a4073154 Merge main (0d61c35) into runtime/compute-path
Resolved along the lines in #291 (comment by ItsNotRexed, 2026-11-22 08:27):

- Default-heap buffers stay in the GPU address arena: a VA is an arena offset,
  and every buffer's device address is heap_base + VA (upload and readback
  buffers: device address minus heap_base, as before).
- Acceleration structures: a buffer created in RAYTRACING_ACCELERATION_STRUCTURE
  state on a ray-tracing device stays out of the arena and keeps main's model,
  its VA being the VkAccelerationStructureKHR's device address, so BLAS
  addresses in TLAS instance descriptions are what Vulkan reads. It is
  registered by that VA. BuildRaytracingAccelerationStructure turns build
  inputs and scratch into heap_base + VA, and the arena gets the build-input
  usage on ray-tracing devices. Resource keeps one va_ (gpu_va_/buffer_va_
  removed).
- buffer_at keeps the size& signature; main's only caller (WriteBufferImmediate)
  is the branch's version, and ExecuteIndirect resolves its buffers by id.
- ~Resource keeps arena_release and main's defer_destroy.
- Main's split context locks: pipeline registration and heap_base/zero page
  take resource_mutex_ (prepare looks pipelines up under its shared lock);
  VulkanPresenter takes resource_mutex_ shared, plus tracker_mutex_ while it
  records the back buffer's transition.
- Standalone device: main's single instance-extension list and DXGI swapchain
  enable; info.presentation follows the same swapchain/surface condition, so
  create_window_presenter keeps working. Main's DeferredDeletionQueue,
  calibrated timestamps and ray-tracing extensions are kept next to the
  branch's presentation and feature enables.
- Command IR: Dispatch and Draw follow main's DebugMarker, ExecuteIndirect and
  BuildAccelerationStructure in the variant.
2026-11-22 05:50:20 -03:00
8241eab041 Docs: relate the CustomClouds type flags to the STS_Config cloud layers
STS_Config has four cloud layers with one shared 13-field set and six media
with a shared 9-field set; two of the five cloud flags match a layer name.
The weather CloudType is fractional, not a layer index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:45:37 +00:00
c0413d69eb Docs: timecycle sample hours come from time_data
The one time_data document has 13 samples with integer hours 0 to 22 in
increasing order, an easing type per sample, and a uw_tc_mod that resolves
to a modifier name; its region matches a keyframe region. Answers the
section's open question about the 13 sample times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:45:37 +00:00
8ccf429a56 Merge main into the S#/T# mip test (#319)
Conflicts in docs/d3d12_vulkan.md, runtime/CMakeLists.txt, check.py,
run_gpu_tests.py and test_shader_checks.py: main's versions with
vk_sampler_test, ps_ssharp and its checks added back (ps_ssharp is drawn
with vs_ids through DRAWN_WITH now).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:43:07 +01:00
2e33dc681a salu_diff: SCC consumers in control flow (--branches, FUZZ-4 follow-up)
With --branches every SCC producer may be followed by a chain of 1..3
consumers (s_cselect_b32, s_addc_u32, s_subb_u32) or by s_cbranch_scc0/scc1
forward over the next 1..3 scalar instructions (one lane, no loops, no
nesting). Half the instructions are drawn from the SCC producers. Program
lines write a branch as "+N" instructions; the listing for the translator
carries the dword offset and ; encoding: placeholders of each instruction's
size (literal = 8 bytes), which place the branch targets. The reference
models the skip, the shrinker keeps skipped ranges consistent, and a
mismatch prints the real offsets. Default runs are unchanged so existing
seeds keep their programs; the hardware oracle refuses --branches.

8000 branch programs (8 seeds, max-ops 6/12/20, one with --bfe-any) match
on main. Also drops the stale "until #349 lands" note (#349 is merged).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:40:38 +01:00
342028959a build_llvm_mc: install llvm-mc outside AppData, where the install manager's python can see it
python from the Python install manager (the WindowsApps alias) doesn't see folders other programs create under %LOCALAPPDATA% or %APPDATA%, so the old default made make_game.py report llvm-mc missing and the fuzzers stop with WinError 2 although LLVM_MC named the file. The default -Dest is now %USERPROFILE%\.leonida\llvm-mc, and the preflight explains an LLVM_MC that points into AppData.
2026-11-22 15:39:48 +07:00
432520f71c Merge pull request #1225 from quackottu 2026-11-22 03:37:56 -05:00
57888e6f29 Merge pull request #1223 from Vonsek
# Conflicts:
#	docs/testing.md
2026-11-22 03:37:56 -05:00
0163c1b5e4 Merge pull request #1222 from Lucy 2026-11-22 03:37:54 -05:00