Commit Graph

4163 Commits

Author SHA1 Message Date
d4f17ae965 Merge branch 'r8/tex-fast' into test/round8 2026-11-28 03:31:07 -05:00
59db4b62b0 runtime: Round 8 WS3 — fix list-value gate TOCTOU, offload QueueHolds barriers, empty-batch/wait coalescing, replay floor & batched xmem slot-31
- Fix Pump::choose_release() TOCTOU on already-completed unlanded write groups/action gates + 10 ms quiet window on Reason::present
- Skip before_execute/visibility_seq on empty batches (preserving pending_wait_vis_seq_), coalesce past GPU-completed Waits (merging CPU vis_seq), cache CommandList summary, atomic unbuilt_sync_pipelines_ & BindlessSet clean fast-paths, hoist EmitScratch
- Dedicated QueueHolds barrier-drain thread with active_work_ tracking, wait_barriers_drained() ordering, cancel_after() wait, and non-blocking VulkanQueue::release_ready()
- Batch copy_page_mappings() per contiguous range & notify Event::replaced on mirror_heap decommit in xmem.cpp
- SEH-guarded aligned volatile read_value() (no noexcept under /EHsc) + 1000 ms slot-12 Vulkan fence mirror timeout

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 03:31:06 -05:00
fbeb3d9080 runtime: Round 8 WS2 — eliminate false texture re-uploads, zero-syscall arm_batch, parallel mirror hash & 512-job GPU detile batches
- Zero ResourceDesc padding words [1,2,3,13], compare non-format words + compatible formats in title_texture_matches(), preserve layout-equal slot-133 textures & mirror_hash_valid on unmap
- Guard refresh_title_texture() touch() against unreadable pending_stream textures while preserving deferred backing & publish_streamed_texture
- Zero-syscall already-armed Cell::restore[] check + table-page backed skip + PAGE_READONLY region cache in TitleTextureCells::arm_batch(); sync_tile_peers() skip in examine_batch()
- Snapshot geometry_writes serial before refresh_page_mirror() to skip redundant page_mirror_check_batch() dirtying on both CPU and GPU views; parallelize Pass 3 range_sum() >= 8 MiB
- Decouple GPU-mirror batching (512 jobs / 128 MiB) from CPU 64-slot limit, single-call vkAllocateDescriptorSets per sub-batch, kMaxScratchSlots=64, 4-part examine_ns telemetry

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 03:31:06 -05:00
f913286051 runtime: Round 8 WS1 — PageMirror batching, direct page table, L1-strip AVX2 hashing, sub-page readback & heap WC buffering
- CellGuard::arm_batch(): per-batch sync_known_protect, range-scoped changes_since(), gap-bridging (<=8 cold tiles, pin-guarded), reopen() fast-path via Cell::armed_map_gen
- shadow_keep::sum_of_batch_256() hoisted AVX2/SSE2/scalar batch hash + 4 KiB L1-hot strips in TitleMirror::upload() & prehash_readback_slice()
- TitleWritePolicy PageRef active lists (no frame_hot) + TitleMirror 2-level per-chunk direct page table + has_pending() fast-path + refs>1 alias handoff
- Feed coalescing + watch_batch/unwatch_batch in refresh_page_mirror()
- Sub-page 256B-aligned vkCmdCopyBuffer readback, page_mirror_buffer resolve_cache, OutScratchGuard WC buffering in apply_in_place_changes/finish_in_place, lock-free reclaim_arena/update_address_guard

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 03:31:04 -05:00
4938673668 Merge pull request #2081 from abnalstlll-byte/feat/rt-pipeline-checkpoint-guards-and-tests
feat(runtime): add input validation guards and unit test suite for d3d12_pipeline_checkpoint
2026-11-28 09:06:26 +01:00
766963e34a Merge pull request #2487 from Tyrannys/rt-gameinput-clip-drag
gameinput: let go of the cursor clip while the window is dragged (RT-GAMEINPUT-CLIP-DRAG)
2026-11-28 09:06:15 +01:00
4295601b81 Merge pull request #2088 from c0pperlane/vk-pipeline-large-admission
vk_pipeline_check: a large module that must wait frees its worker (VK-PIPELINE-CHECK-LARGE-ADMISSION)
2026-11-28 09:06:04 +01:00
ffbfef54bd Merge pull request #2153 from Joaco9020/fix/direct-heap-dispatch-test
test: bind a PSO before direct heap dispatch
2026-11-28 09:05:52 +01:00
c912546318 Merge pull request #2082 from alexandersato0830/codex/gameinput-mouse-delta
Keep keyboard-pad mouse deltas in range (RT-KEYBOARD-PAD-MOUSE-DELTA)
2026-11-28 09:05:40 +01:00
23e51d3be8 Merge pull request #1191 from titoreinaldo/contrib/w64-invariant-checks
[TEST-W64G-TIER-C-INVARIANTS] Check known graphics outputs before skipping or saving a reference
2026-11-28 08:47:26 +01:00
6bd0c4e52b Merge branch 'r7/sync-tex' into test/round7 2026-11-28 02:14:47 -05:00
ec6251ec85 Merge branch 'r7/mirror-wb' into test/round7 2026-11-28 02:14:47 -05:00
49da651a9b runtime: slot-70 deferral, lazy TitleImageUpload waits, per-fence vis_seq, unlocked run_barriers, and cached arm_batch
Eliminates single-texture slot-70 storms, multi-queue TitleImageUpload lock/submit stalls, gratuitous coalescer invalidations, and Present pump_mutex_ blocks:
- d3d12_vulkan_device.cpp: defers slot-70 make_title_texture()/refresh_title_texture() to batched refresh_title_textures() (with texture_watch.touch); skips re-dirtying hot pages when mirror_just_synced; ports changes_since()-tracked known_protect cache into TitleTextureCells::arm_batch().
- d3d12_title_image_upload.h / vulkan_title_detile.h / vulkan_backend.h / vulkan_indirect_clamp.h: caches PFN_vk* procs, raises kMaxBatchCmds=64 / kMaxScratchSlots=32, waits on oldest_in_flight_scratch_value(), batches vkUpdateDescriptorSets, replaces empty consumer submits with lazy note_title_upload_locked waits in submit_multi(), unlocks submit_mutex_ during upload recording, decouples prepare_indirect_clamp from tracker_mutex_, caches ReplayFunctions, and times tracker_lock waits.
- queue_holds.h / vulkan_backend.h / vulkan_present.h / d3d12_com.cpp: tracks per-(fence,value) vis_seq in QueueHolds (stopping GPU-signal & list-values false invalidations), fixes BeforeExecuteCoalescer cv.wait loop + adds 5-step leader timing, decouples QueueHolds::run_barriers() from pump_mutex_ via barrier_mutex_, and expands VulkanPresenter::frames_ to 4.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 02:14:47 -05:00
aff99e069a runtime: parallel Phase-A heap filter, single-lock unwatch, fault VirtualQuery skip, and 64 MiB copy-queue readback
Cuts PageMirror refresh, write-fault, unwatch, and GPU write-back overhead:
- d3d12_vulkan_device.cpp / title_mirror.h / console_heap_slot_records.h: hoists 1024-entry FilterPageCache across upload(), buffers filtered slots in 64 KiB host scratch with coalesced WC BAR flushes, parallelizes pure read-only Phase A heap filtering across WorkerPool with sequential Phase B under page_mirror.mutex, and adds none->none / idempotent place() fast paths.
- title_mirror_hot_cold.h / title_geometry_watch.h / xmem.cpp: fixes HotColdTracking::unwatch() triple-lock/bogus-WriteQueue bug with single-lock geometry_writes::release(addr, was_hot), skips redundant 2nd VirtualQuery in notify(Event::fault), and passes ranged changed(start, end) from xmem.cpp.
- d3d12_vulkan_device.cpp / title_mirror.h: raises kReadbackPages to 1024 (64 MiB), routes readback copies onto info.copy_queues, bypasses kernel_writes::write() on xmem scratch frames (frame != page_va), batches begin_write/end_write per ordinary page, and lowers whole_title_ok threshold to 2.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 02:08:11 -05:00
586970b5ba runtime: dynamic rendering scope batching, no-op LayoutTracker elision, and cached ConsoleHeapGpu procs
Cuts replay CPU and Direct GPU render-pass overhead:
- vulkan_replay.h: merges consecutive draws with matching (colors, depth + depth_aspects, area, layers) into one vkCmdBeginRendering..vkCmdEndRendering scope with coalesced same-layout attachment barriers, closing cleanly on non-draw/glc/indirect_clamp/quad/query/stats/gpu_profile/marker boundaries; elides no-op LayoutTracker::set() journaling; adds per-pass 32-entry PrepareViewCache and lightweight Prepared::reset().
- console_heap_gpu.h: caches all 20 PFN_vk* device proc pointers once in VkFns.
- replay_state_cache_test.cpp: adds scope batching, boundary split, LayoutTracker no-op, PrepareViewCache, and live VVL GPU tests.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 02:05:03 -05:00
25fd8e4776 Merge remote-tracking branch 'origin/main' into fix/rdna2spirv-f16-interp-computed-ij 2026-11-27 23:02:20 -08:00
cd8b5632b8 Merge branch 'main' of https://github.com/ProjectLeonida/mandy into test/round6 2026-11-28 01:22:20 -05:00
80734a849c runtime: wire scoped readback skip masks into batched texture checks and console heaps
Routes page_mirror_check_batch() uploads through note_readback_pieces_uploaded_locked() and console-heap page invalidations through note_readback_frame_invalidated_locked() so unrelated pages never poison readback_invalidated; renames a shadowed parameter in title_texture_watch_test.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 01:09:18 -05:00
ccd77445fa Merge branch 'r6/textures-watch' into test/round6 2026-11-28 01:08:13 -05:00
6fd734ee84 Merge branch 'r6/queue-contention' into test/round6 2026-11-28 01:08:13 -05:00
f6d3f30c4e runtime: batched mirror texture checks, GPU-fallback mirror_hash skip, and batched tile arming
Eliminates false CPU-staged re-uploads, per-texture page_mirror.mutex churn, and unbatched tile re-arming:
- d3d12_vulkan_device.cpp: replaces per-texture page_mirror_texture_chunk/page_mirror_tiles_unchanged with a single-lock page_mirror_check_batch() snapshotting pending xmem remaps under shared feed_lock (rejecting only overlapping textures) and running one batched parallel TitleMirror::upload(); adds TitleJob::previous_mirror_hash check in hash_title_job() so GPU-uploaded textures falling back to CPU skip unchanged re-uploads; separates lock_wait_ns from collect_ns.
- title_texture_watch.h / title_texture_refresh.h: adds examine_batch() + TitleTextureCells::arm_batch() coalescing pins and contiguous VirtualProtect runs, uses direct Tile*/Texture* pointers in watch indices, and merges write/map ranges before iteration.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 01:08:13 -05:00
758b98756c runtime: single-flight before_execute coalescing, frame-group async room, and lock/worker telemetry
Eliminates multi-worker global lock convoys, Wait-split async room stalls, and instrumentation blind spots:
- vulkan_backend.h / d3d12_vulkan_device.cpp / d3d12_com.cpp: adds visibility_seq_ & signaled_visibility_seq_ tracking and BeforeExecuteCoalescer so concurrent/back-to-back cross-queue submissions serialize global refresh passes to one leader and skip redundant refreshes when pass_seq >= req_seq (opt-out LEONIDA_BEFORE_EXECUTE_COALESCE=0).
- vulkan_backend.h: replaces Wait-broken pending_submit_groups_locked() with pending_frame_groups_locked() and max_batches = max(16 * depth, 64) for depth >= 2, eliminating mid-frame room_cv_ stalls on Wait-heavy frames.
- vulkan_backend.h / submit_phases.h: includes release_held() and pump_ready() in async_worker() busy time and adds worker_lock_wait_ns reporting.
- d3d12_vulkan_device.cpp / d3d12_com.cpp: lock-free ConsoleHeap::in_place_work_pending fast-skip, FilterPageCache in finish_in_place(), identical-base dedup of mirror_ranges, and cached console-heap fast-path in GraphicsCommandList::address().

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 01:06:40 -05:00
3007ae0d35 runtime: unlocked parallel readback pre-hashing, piece-level skip masks, and single-map CellGuard
Eliminates the async readback page_mirror.mutex convoy and serial fallback, and reduces page-mirror refresh cost:
- title_mirror.h / d3d12_vulkan_device.cpp: lifts WorkerPool for lock-free Phase 1 prehash_readback_slice() outside page_mirror.mutex and single-call Phase 2 write_back_prehashed() under lock (256-page slice: 0.11 ms unlocked, 0.03 ms locked), eliminating the 256x serial single-page fallback and merge_ranges() storm.
- Scopes readback invalidation to readback_slice_frames with per-frame 256-bit readback_slice_skip_masks populated from TitleMirror::upload(on_changed), preventing hot-page retry loops while preserving CPU-wins conflict semantics.
- Coalesces contiguous GPU write-back runs, batches deferred map() initial fills in parallel upload(), and replaces fed_now unordered_set with a flat sorted vector.
- title_mirror_hot_cold.h: consolidates CellGuard maps into a single TrackedCell map and adds a changes_since()-invalidated known_protect cache to halve cold re-arm VirtualQuery syscalls.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 01:04:24 -05:00
faf1ee314c Merge branch 'r5/queue-coalesce' into test/round5 2026-11-28 00:14:11 -05:00
6c3cc1c18d Merge branch 'r5/textures-fast' into test/round5 2026-11-28 00:14:11 -05:00
89fe359ee0 runtime: VulkanQueue execute+signal coalescing, fast heap filtering, and batch-parallel sync compiles
Cuts queue submit overhead, descriptor-heap filtering cost, and synchronous cold pipeline compile latency:
- VulkanQueue: adds pending-wait tracking (has_unsatisfied_waiter), deduplicated submit_multi(), execute+signal coalescing with cross-queue/CPU waiter splits, and coalescing-group-aware async room gating.
- d3d12_com.cpp: caches descriptor heap VAs/counts on SetDescriptorHeaps, pre-tracks command-list barrier/query/indirect/draw flags, single-alloc PinnedObjects, and linear table dedup.
- d3d12_vulkan_device.cpp: AVX2 32-byte slot equality, 8 KiB L1d seen_keys, stack-local FilterPageCache, 64 KiB page-pointer caching, and T# dedup in finish_in_place.
- vulkan_replay.h / d3d12_vulkan_device.cpp: lightweight collect_unbuilt_pipelines() pre-pass and cancel-safe batch-parallel sync compile runner backed by PipelineCompiler.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 00:14:10 -05:00
184d03eca8 runtime: fast mirror-hashed texture refresh and watermarked passive write-back
Cuts per-submission texture refresh overhead and prevents passive write-back accumulation across overlapping queues:
- title_texture_refresh.h: adds shadow_keep::sum_of-backed mirror_range_sum helpers and PassiveWriteBackTracker with retire_id watermarking so overlapping direct/compute queues promote each passive V# range without re-promoting stale ranges indefinitely.
- title_texture_watch.h: skips hot_tiles() rescans when hot_generation() is unchanged and tracks non_hot_arms to reuse synced shared hot tiles per pass.
- d3d12_title_image_upload.h: reuses detile scratch buffers across sub-batches and skips detile setup when unused.
- d3d12_vulkan_device.cpp: extends TitleMirror range_sum() skip to all 256B-aligned and partially mirrored textures, filters dirty chunk syncs by title_written_ (guarded by !t.stale), caches can_gpu_upload(), pools TitleJob buffers, runs inline single-item reads/hashes, and defers t.pieces commits until upload success.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 00:06:16 -05:00
ecbdb30d10 runtime: AVX2/SSE2 shadow_keep::sum_of, parallel TitleMirror pool, and batched CellGuard arming
Speeds up shadow page hashing, TitleMirror upload/write-back, and guard re-arming:
- shadow_keep::sum_of: 4x256-bit AVX2 (#if defined(__AVX2__)) and 4x128-bit SSE2 fast paths with portable scalar fallback (2.52x single-core AVX2 speedup).
- TitleMirror: lazy 6-worker thread pool with exception-safe teardown and RAII join guard parallelizing upload() and write_back_batch() for >=16 homes/jobs (4.76x upload, 6.08x write-back) while preserving exact serial aliasing semantics.
- CellGuard::arm_batch(): 1024-page contiguous runs, pin-batching outside mutex, and generation-guarded VirtualQuery cache.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 00:01:22 -05:00
2836c5f1b1 docs: cs_fma_fused reads 0x7352 in its f16 word on KosmicKrisp at run time
Tauwni measured it in the review of #1724 (Apple M3, Mesa 26.3.1, 20 of 20 runs): with
run-time operands the f16 multiply-add comes out as if the product were rounded first, one
step from 0x7351. With literal operands the constant was folded exactly, so the fixture
passed there before. MoltenVK 1.4.2 and llvmpipe give 0x7351 on the same machine.

A Known problems row and a line in the fixture's header; no instruction changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:48 +08:00
420116dbbc tests: cs_fma_fused takes its f16 operands at run time, like its f32 ones (TEST-FMA-FUSED-F16-RUNTIME)
The fixture reads the operands of its f32 multiply-adds from s4..s7 so that a driver has to
compute them at run time. The three operands of its v_fma_f16 were literals, which made the
whole f16 multiply-add a compile-time constant. MoltenVK 1.4.2 gives the wrong constant: word
7 read 0x0000 on an Apple M5 (0x3c00 in the docs' row) where 0x7351 is expected, the
cs_fma_fused failure listed in docs/testing.md and in the macOS job's EXPECTED_FAILURES. The
same translation with any one of the three operands taken at run time gives 0x7351.

The triple is now the s4 word XOR a literal each, so the test checks the translator's
round-to-odd sequence as the GPU runs it. The translator is not changed.

tests/semantic/test_fma_fused_fixture.py runs the fixture in the interpreter against the eight
words of its header and checks that no multiply-add in it reads a register only literals fed.
The Known problems row says what is left: an f16 multiply-add with only constant operands.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:48 +08:00
6064cbbb49 tests: build.py and check.py pick the f16 interpolation fallback from the device (TEST-CHECK-F16-FALLBACK)
run_gpu_tests.py and make_game.py translate with --f16-interp-fallback by
themselves where tools/vk_subgroup_info.py reports per_vertex_inputs
false (MoltenVK). build.py and check.py only did so with
LEONIDA_F16_INTERP_FALLBACK=1, so the two-step form on a Mac built
ps_ij_computed and ps_interp_f16_high for PerVertexKHR inputs and
check.py reported both as failed.

Both scripts now ask the device when the variable is unset, the way they
already do for the barycentric fallback, and take 1/0 (true/false, yes/no,
on/off) as run_gpu_tests.py does. On an Apple M5 (MoltenVK 1.4.2) check.py
goes from 175 of 220 pass, 39 skipped, 6 failed to 176 pass, 40 skipped,
4 failed: ps_interp_f16_high passes and ps_ij_computed is a SKIP.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:46 +08:00
f6ec7480ff library_loader_names: run with Wine's native wsock32, and check the copy is the fixture
Under Wine, loading a wsock32.dll by path gives Wine's builtin wsock32, not the
fixture copy, so the same-base checks failed (Tauwni, Wine 11 on macOS, #2525).
CTest now runs the test with WINEDLLOVERRIDES=wsock32=n,b, which Windows ignores
and scripts/run_wine_tests.py keeps, and the test checks by path that the module
it loaded is its own copy, saying why when it is not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 22:36:30 -06:00
5d677b7ba2 cpu_emulation: a CLWB #UD on a site another thread rewrote continues at it (RT-CLWB-PATCH)
Threads that fault on the same CLWB site together lost the race: a #UD handled
after another thread rewrote the site decoded CLFLUSHOPT (or the NOP), did not
know it and returned EXCEPTION_CONTINUE_SEARCH, which ends the title.

- The handler continues at a site that already holds the form written on this
  host (or the NOP's halfway state): the CPU runs it.
- One lock around unprotect, re-check, write and protect again, so two threads
  never interleave on a page; a site found rewritten under it is not written.
- The NOP is written opcode first (66 0F 1F /6 in between is a NOP too).
- The sites counter counts each site once, by the thread that wrote it.

cpu_emulation_test calls the handler with a made-up #UD, so it runs on hosts
with CLWB: first #UD, a second one on the rewritten site, and 16 threads on
2048 fresh execute-read sites. Before the fix 27958 of 32768 concurrent #UDs
were passed on, 4810 rewrites were counted for 2048 sites and pages were left
writable; with it all checks pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 05:28:00 +01:00
65acf73246 runtime: remove frame-hot mirror over-copying and measure write-back CPU time
Promoting 1x/frame pages to unguarded hot caused HotColdTracking to copy
~5,000+ pages on every submission (~50 GiB/10 s) and dirtied all textures
sharing those tiles (~119 ms/sub). Restore the submission-hot (6/8)
policy where unguarded copies beat fault+copy cost, and accumulate actual
CPU+wait time in AsyncReadback::cpu_ms instead of async wall-clock span.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 23:24:53 -05:00
63a73515d1 Merge remote-tracking branch 'origin/main' into fix/clwb-patch-race 2026-11-28 05:22:21 +01:00
f4df7c4797 Merge remote-tracking branch 'mandy/main' into test/round4 2026-11-27 23:03:33 -05:00
5c815be84b Merge the upstream shared BC image fix into per-format staging
Retain staging for shared BC images on devices without host copies and keep the per-image fallback for formats without usable host-transfer backing.

AI-assisted-by: OpenAI Codex (GPT-6)
2026-11-28 14:00:35 +10:00
f77359c5b4 Merge pull request #1565 from Mike7581/rt-compat-dir-runtime-loads
loader: a run-time LoadLibrary takes the LEONIDA_COMPAT_DIR module too (RT-COMPAT-DIR-RUNTIME-LOADS)
2026-11-28 00:48:31 -03:00
477f56cc1a Merge pull request #1564 from Mike7581/rt-crt-quick-exit-tls
process: the game's at_quick_exit handlers and thread-local exit callback are the run's own (RT-CRT-QUICK-EXIT-TLS)
2026-11-28 00:48:27 -03:00
725d223757 Merge pull request #1549 from Mike7581/mvp-gpu-04-stub-pipeline
d3d12: LEONIDA_STUB_PIPELINES builds a real graphics pipeline from built-in stages (MVP-GPU-04)
2026-11-28 00:48:22 -03:00
e9bd907508 runtime: add ReplayStateCache and two-tier frame-hot TitleWritePolicy
Cache bound pipelines, descriptor sets, dynamic graphics state, and dirty
push-constant sub-ranges across command lists in emit_commands() (with
invalidation across internal compute helpers and rendering boundaries),
and restore the two-tier submission-hot + presented-frame-hot policy in
TitleWritePolicy/HotColdTracking wired to present_serial.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 22:29:42 -05:00
085cb0cc61 Merge branch 'r3b/glc-writeback' into test/round3
# Conflicts:
#	runtime/src/vulkan_backend.h
2026-11-27 21:16:08 -05:00
072327cfad runtime: tighten TitleMirror/GeometryViews lifetime guards and PR hygiene
Guard GeometryViews retirement with command_list_epochs, defer TitleMirror
freed-home ticket stamping until flush + note_mirror_bind under submit_mutex_
(including TitleImageUpload submits), fix queue lock ordering and lock-free
wait_submitted, remove dead helpers and process labels, and scrub game shader
identifiers from docs/design.md.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:13:23 -05:00
4a70845069 gameinput: SetParams keeps the force-feedback effect's kind
IGameInputForceFeedbackEffect::SetParams updates the parameters of the
effect's own kind; another kind is refused and the effect keeps what it
had (timbot103's review on #2497). SetParams checked only that the motor
reports the new kind, so a constant effect could become a sine. It now
refuses any params->kind other than the effect's.

An effect's SDL type therefore never changes, and the destroy-and-
recreate path this PR added to sync() for a kind change is unreachable,
so it is removed again.

gameinput_test: SetParams refuses both a kind the motor lacks and one it
reports, leaves the parameters and the SDL effect alone, and the sine
and spring checks run on effects of their own made with
CreateForceFeedbackEffect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:11:46 -06:00
59feb165bd d3d12_xs: leave a mapped descriptor range to the queue's pull at submission
From timbot103's review of #2498.

A mapped real range is the Vulkan device's live arena: shaders of lists
already submitted read it, and the queue rewrites the slots it pulls there
in place (title buffer addresses rebased) when it submits. local_mirror_table
copied the title's raw slots into it while a list was being recorded
(SetGraphicsRootDescriptorTable / SetComputeRootDescriptorTable), which could
overwrite a translated slot an earlier submission was still reading. The
first commit of this PR made that happen on Wine as well; on Windows, where
VirtualQuery reports the arena as accessible, main already did it.

local_mirror_table now leaves a mapped range alone. The queue pulls the
title's slots of every bound table itself at submission
(pull_title_descriptors through title_va_aliases), which needs no
VirtualQuery of the arena, so Wine loses nothing.

xs_proxy_mock_test, check_descriptor_mirror case 2: with a translated value
in the real slot, binding a table over it (graphics and compute) leaves the
slot as it was, and the submission-time pull then takes the title's slot.
The previous commit fails the first of these checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:11:24 -06:00
181e9dfdda runtime: add GLC barriers, literal sampler specialization, and writes_buffer write-back gating
Enable Vulkan 1.2 vulkanMemoryModel/vulkanMemoryModelDeviceScope and emit
pre-dispatch/pre-rendering barriers for reads_glc_buffer shaders, wire
literal_sampler_spec_base VkSpecializationInfo specialization constants,
and gate passive title buffer write-back on shader writes_buffer metadata
with non-blocking async readback polling.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:10:54 -05:00
450c5e52b3 library_loader: ask Windows for a host module's name on every GetProcAddress
Dropping the HMODULE -> name entry in free_library() after FreeLibrary
left a window (timbot103's review on #2525): between FreeLibrary and the
erase, another thread can load a different DLL at the freed base and
call GetProcAddress, which then found the old name and served the old
module's shims. Holding loader_mutex across FreeLibrary would invite a
lock-order inversion with the loader lock.

So there is no cache any more: host_module_name() calls
GetModuleFileNameW each time, which always answers for the module mapped
at that base now, and free_library() is a plain FreeLibrary again.

library_loader_names_test gains the window itself: the host's
FreeLibrary is called directly, so the shim never sees the unload, and
the plain copy loaded at the same base must not be served the shim. It
fails with the cache-and-erase version and passes now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:07:50 -06:00
37163d100f ws2_offline: the host reports an extension lookup's completion; AI_NUMERICHOST keeps localhost a name
From timbot103's review of #2533.

- The ConnectEx and WSASendMsg lookups no longer complete the caller's
  overlapped themselves (complete_now). That posted no packet for a socket on
  an I/O completion port, so a caller waiting in GetQueuedCompletionStatus
  hung, and it signalled an overlapped a socket without WSA_FLAG_OVERLAPPED
  must ignore; its APC record also leaked if the thread never waited
  alertably. The host's WSAIoctl now gets the caller's overlapped and
  completion routine again, so the completion is reported as Winsock reports
  it, but writes its own pointer and byte count into storage of the shim's
  (wrap_extension_lookup): freed when the call completed, kept if the host
  reports it pending. The caller's buffer holds the wrapper before the host
  is called, so a packet another thread dequeues already finds it, and gets
  its old contents back on failure.
- With AI_NUMERICHOST, "localhost" is passed on as the name, so the host
  refuses it with EAI_NONAME instead of the shim answering with a literal.

ws2_offline_test: a completion-port socket gets its packet with the wrapped
pointer; on a socket without WSA_FLAG_OVERLAPPED the overlapped ends as the
host's own WSAIoctl leaves it; getaddrinfo(localhost, AI_NUMERICHOST) is
EAI_NONAME. The event and routine cases follow what Windows 11 does for this
lookup (measured: event set, routine run once, packet posted, 0 bytes in the
OVERLAPPED). The previous commit fails these 3 checks; 87/87 pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:07:18 -06:00
842e0f641c xgameruntime_gamesave_test: Case E runs where the host has no CopyFile2
CopyFile2Trap left itself unarmed when kernel32 exports no CopyFile2,
and Case E then failed on Wine 9, the host this PR is for (timbot103's
review on #2532). A missing export is now told apart from a patch that
failed: with no CopyFile2 there is nothing that could be called, so the
overwrite and rollback checks run against the real host, and only an
export that exists but cannot be patched fails the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 20:06:01 -06:00
27524a5e5b Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias-moltenvk 2026-11-28 02:57:41 +01:00