Clang's baseline x64 target cannot inline _mm_stream_load_si128 into copy_guarded. Give only that function the target feature the existing intrinsic requires; keep the MSVC path and global build flags unchanged.
Depends on: #8225. Claimed in #8186, comment7110252121. AI-assisted: yes (Codex).
IGameInputDevice::SetHapticMotorState computed the end of a request as
duration * playCount + repeatDelay * (playCount - 1), then now + total, all
in uint64 microseconds with no overflow check. A very long request wrapped:
duration = UINT64_MAX with playCount 1 put the deadline just before now, so
the motor never played, and duration = 2^63 + 50 ms with playCount 2 wrapped
to a 100 ms request that stopped early.
The products and sums now saturate at UINT64_MAX, a deadline the poll
thread never reaches, so such a request plays until the state is set again.
Requests that fit are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When VK_EXT_external_memory_host refuses the title's pages (write-combined or uncached pages, pages not committed yet, no extension, or the driver's import budget: about 64 MiB on an RTX 3070 Ti), the fallback was an ordinary DEFAULT buffer with neither the title's VA nor its data, so the title's descriptors resolved to nothing (slot 70 wrote a null SRV) and UI draws sampled nothing.
The fallback is now a host-visible buffer (VRAM through Resizable BAR where upload buffers use it) whose console VA is the title's address, filled from the title's pages at creation and again before every submission of command lists (VulkanContext::set_before_execute, called from VulkanQueue::execute_now). Only committed, readable pages are read; the rest is zero. GPU writes to the shadow are not copied back.
The first per-submission copy of each buffer size is timed and logged. Write-combined pages are read with MOVNTDQA: memcpy read 64 MiB of them in 253 ms on a Core i9-13900K, MOVNTDQA in 13 to 17 ms.
Tests: write-combined, uncached, 64 MiB write-combined and half-committed ranges in d3d12_existing_heap_test, two patterns over two submissions each, 0 validation errors on an RTX 4090.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From @tupacfan04's review of #7903: on a boot stack with the console list
proxy (#7076), the title's lists are proxies whose QueryInterface answers
only the console and public list IIDs. The shim asked the proxy itself, so a
private interface was refused, and a PC interface it did answer would have
been called through a console-shaped vtable.
d3d12_xs_device exposes real_object_behind_proxy(), the real object behind any
child proxy (proxy_real_object, which a console list proxy joins, as the file
and #7076 say), and the shim asks that real list for
ID3D12GraphicsCommandList4. On main lists aren't wrapped, so nothing changes
there; with #7076 the shim follows its lists without a further change.
docs/xdxr.md: BuildRaytracingAccelerationStructureBatched2X is 6 call
[rip+disp32] sites through the import table; IDA counts 8 direct calls, two
of them in another form (@FJKiXfaR on #7516).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's third word at slot 133 is a D3D12_BARRIER_LAYOUT, not a resource state (measured by
@dracbat on a retail boot: 0x6 SHADER_RESOURCE for its RT/DS textures, 0x3 UNORDERED_ACCESS for its
RT+UAV ones, 0xFFFFFFFF UNDEFINED for the 182 MiB buffer), as PC CreatePlacedResource2 takes it. The
proxy passes it to the handler, and a texture's ordinary committed fallback starts in the equivalent
legacy state (UNDEFINED and unlisted values give COMMON; a state the description refuses retries with
COMMON, so the title always gets its resource). Buffers are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One PC slot 76 mock records for both the slot 133 and the slot 127 checks;
one slot 27 mock keeps #7075's record and #7240's generic path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit-on-touch checks expect hardware faults from plain loads and
stores inside __try. MSVC catches those as it is; clang-cl only with
asynchronous exceptions, so without /EHa the expected fault escaped and
xmem_test crashed. Same option as tiny_dll. Reported by AirKyzzZ in #7556.
Wine can report a requested write-combined allocation as ordinary read/write memory. Check the observed protection and retain the fallback expectation when a cache modifier is present; otherwise verify the read/write import. Add PAGE_NOCACHE to keep the unsafe-protection guard covered under Wine.
Claim: https://github.com/ItsNotRexed/Leonida/issues/7913#issuecomment-7109390728
Depends on: #7218
AI-assisted: Codex
- Merged Roberto0953's rebase (main 042c5f37 + install_on_existing_threads covering kMainImageSlot, so a
thread already running at load() gets the executable's slot-0 block like every other module's) and then
the newest main (clean).
- runtime/README.md: the index-0 paragraph said older threads get the copy through install_tls_for_thread();
since main's existing-thread install they get it from load() itself, as the limits section already says.
- check_tls_index0.cmake: Wine's GetTempPathW falls back to the user's Temp folder when TMP and TEMP name a
missing one, so the reservation cannot fail there; the refusal part is skipped under an emulator
(jlric, isfcrctfs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
unmap_range splits a view by unmapping it and remapping both sides; with one view per run
that cost grew with the run (review on #7584). Capping views at 64 MiB bounds it.
From @KarolKurzyna's review of 242a5dbf1:
- builder_device() returned the builder's device without a reference, so a
destructor on another thread could release it during
GetRaytracingAccelerationStructurePrebuildInfo. It now takes a reference
under the lock, and the caller releases it after the call.
- The test only passed an unwrapped device. It now also constructs a builder
on a d3d12_xs device proxy (create_device_proxy, as D3D12XboxCreateDevice
hands out) and checks that its prebuild sizes are the real device's
(13 checks).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The handler queried the protection at the start of the 64 KiB page, so
a write to a 4 KiB part the title had made read-only looked allowed and
was resumed, faulting again forever instead of reaching the title's own
handler. It now looks the record up by the page and the protection up
by the faulting address. xmem_test writes to a read-only 4 KiB part of
a read-write page and expects the fault.
Address review feedback on #7268:
- Mirror runtime/src/queue_families.h (pick_queue_families followed by
sparse_capable_queue_families) in exact selection order: pick the first
non-graphics async compute and fine-grained (1x1x1) DMA transfer families
first, then fall back to the graphics family if the chosen family lacks
VK_QUEUE_SPARSE_BINDING_BIT. Also read the graphics family index from
vkCreateDevice's pQueueCreateInfos[0] when present.
- Validate vkGetPhysicalDeviceQueueFamilyProperties dumps strictly against
pQueueFamilyPropertyCount and contiguous indices 0..count-1 so incomplete
or truncated entries are never silently dropped.
- Add synthetic unit tests covering non-sparse compute/DMA ahead of sparse
families and malformed/incomplete queue-family dumps (29/29 pass).
AI-assisted.
After a partial unmap or remap, a run of consecutive pages can lie across several host placeholders, and
MEM_REPLACE_PLACEHOLDER needs the view to fill one placeholder exactly, so mapping the whole run again failed with
ERROR_INVALID_PARAMETER. map_view now maps one view per placeholder the run spans; a fresh window is still one view.
Found and fixed by dotaku22 in review; xmem_test gains their check (the whole run maps again over a split range).