Commit Graph

4696 Commits

Author SHA1 Message Date
cc4b374499 d3d12: translate ARRAY_OF_POINTERS instances on the KHR path
KHR TLAS builds hardcoded arrayOfPointers = VK_FALSE and passed the guest's console-VA pointer list straight to Vulkan. Carry DescsLayout into the recorded build, validate each pointer, stage a copy with heap_base added into a device-addressable buffer, and use it as the build input. The guest input is not modified and GPU-written pointer lists are refused. Adds ARRAY and ARRAY_OF_POINTERS RayQuery coverage plus a null-entry refusal check.
2026-11-23 02:12:09 +03:00
b70fdadc8b d3d12: ExecuteCommandLists refuses a list whose type isn't the queue's
ID3D12CommandQueue::ExecuteCommandLists only refused bundles: a DIRECT
list ran on a COPY or COMPUTE queue (its draws recorded for a
transfer-only or compute-only Vulkan family) and a COMPUTE or COPY list
on any queue. D3D12 requires the list's type to be the queue's (the
debug layer's EXECUTECOMMANDLISTS_COMMANDLISTMISMATCH, message 836).
A mismatched list now refuses the whole batch with nothing submitted,
like the layer's other ExecuteCommandLists checks.

d3d12_queue_list_type_test: every list type on every queue type, and a
batch whose matching DIRECT list copies a marker while its second list
doesn't match; the marker must not land. On the old code 8 of its 16
checks fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:12:06 +01:00
245a761c6e docs/movies.md: the Bink2Scarlett ABI measured over the archive (ASSET-324)
A new "ABI over the archive" subsection gives the HBINK fields (width
+0x00, height +0x04, frames +0x08, current frame +0x0c, playback rate
+0x14/+0x18, audio tracks +0x38) and the BINKSUMMARY ones (144 bytes;
width +0x28, height +0x2c, file rate +0x34/+0x38, playback rate
+0x3c/+0x40, frames +0x48), each matched on all 515 streams, and the
return values: BinkDoFrame and BinkCopyToBuffer 0 on every call, BinkWait
0 before the first frame and 1 when called before the next is due.
Section 5's ABI bullet and the decode-evidence bullets now point there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:09:32 +01:00
7013e6c025 runtime: bink_abi_test measures the HBINK and BINKSUMMARY fields over movies.rpf (ASSET-324)
An optional Windows test that maps the package's Bink2Scarlett.dll with
rt::Loader and opens every stream of a tools/bink_index.py CSV in place
inside movies.rpf (BinkSetFileOffset + BinkOpen 0x20). For each stream it
keeps the HBINK and BINKSUMMARY word offsets that hold the header's width,
height, frame count, frame rate and audio track count, follows the current
frame number across BinkOpen/BinkNextFrame/BinkGoto, and tallies the
BinkWait/BinkDoFrame/BinkCopyToBuffer return values. One stream is reopened
with BinkSetFrameRate(24000, 1001) to separate the playback rate from the
file's (flag 0x1000, the only single bit that applies it).

1.0.2.1: 515/515 streams, RESULT PASS in 46 s. Offsets and counts only;
no frame is written. Skips (77) without LEONIDA_GAME_DIR/LEONIDA_BINK_INDEX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:09:32 +01:00
bdb2a62b42 d3d12_boot_movie: filter the scaled comparison and keep the frame override alive
The scaled branch compared each presented pixel with one source texel at
floor(x*W/ew), but the presenter blits with VK_FILTER_LINEAR when the extents
differ, so a correctly scaled frame failed wherever the blit blends. The
expected pixel is now sampled at destination texel centres with the presenter's
own filter (linear when the source format reports linear filtering, nearest
otherwise), and the centre/corner probes use the same model. The 1:1 run stays
bit-exact.

LEONIDA_MOVIE_FRAME was parsed from a temporary std::string whose buffer died
before *end was read; the string now lives in a local.

Verified with the real 3840x2160 movie under Wine/Xvfb: 1:1 exact, 8,294,400 of
8,294,400 pixels, worst 0; with a temporary 1600x900 window, 1,440,000 of
1,440,000 within 2, worst 1.
2026-11-22 20:08:55 -03:00
26ca9529bd test: report process exit query failures 2026-11-22 23:05:56 +00:00
40cf85c2e3 d3d12: retain invalid upload self-copy Close rejection 2026-11-22 18:05:46 -05:00
b6299c9d82 process shim: the game thread that ends a run no longer exits the process before gta6rt finishes
end_run signalled g_done and only then read g_running. run_entry wakes on g_done, closes it and clears
g_running, so the game thread could read false and take the "run is already over" path: ExitProcess with
the game's code while main.cpp was still printing "game exited with code N", reporting unimplemented
imports, writing the trace "exit" event and cleaning up TLS clones. The exit code stayed right, but the
lost line made run_startup_cmdline and the other checks that look for it flaky.

end_run now reads g_running before it signals. g_running is set before the game thread starts and is
cleared only after g_exited is claimed and g_done is set, so a read taken before the CAS is true for any
thread that ends a live run. The exit during host shutdown (no run active) still calls ExitProcess, and
so does an exit with no run started, which an "always park the CAS winner" fix would have hung.

process_cmdline_test runs 50 entry points that return 77 on one CPU and fails (exit 77) without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 02:04:13 +03:00
820c1b6221 d3d12: preserve command lists with legal no-op copies 2026-11-22 18:02:34 -05:00
3ac0ee5f34 startup trace: log OutputDebugStringW once, not again as its lossy ANSI fallback
With no debugger attached, OutputDebugStringW raises DBG_PRINTEXCEPTION_WIDE_C and, when nothing
handles it, calls OutputDebugStringA on its own ANSI copy of the text, which raises
DBG_PRINTEXCEPTION_C. The trace handler logged both, so every wide debug line appeared twice, the
second one lossy (characters outside the ANSI code page became "?").

Remember the wide exception's ANSI pointer (ExceptionInformation[3]) in a thread_local and skip the
ANSI exception whose string pointer ([1]) matches it. Every debug string on the thread resets the
marker, so only the exception right after the wide one is ever skipped and a later
OutputDebugStringA is still logged. startup_trace_test checks one UTF-8 line for a non-ASCII
OutputDebugStringW and that the OutputDebugStringA after it is still there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 01:59:12 +03:00
9b28252a69 vk_compute_test: take the validation setup from a shared runtime/test/vk_validation.h
OptInValidation reads LEONIDA_VK_VALIDATION, adds VK_LAYER_KHRONOS_validation, VK_EXT_debug_utils and
a messenger to the instance (keeping what the program already enables), counts validation-type
errors and turns them into the exit status. vk_compute_test uses it instead of its own copy, so the
other shader test programs can opt in with a few lines. docs/testing.md also no longer lists
vk_image_fuzz as a program that ignores the variable (it reads it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:56:57 +00:00
0f7125e674 vk_compute_test: run under validation with LEONIDA_VK_VALIDATION, fail on a validation error (TEST-877)
vk_compute_test created its instance without layers and ignored LEONIDA_VK_VALIDATION, and a
validation message never changed its exit code, so scripts/run_gpu_tests.py could not catch what
GPU-assisted validation finds in the compute fixtures (SHADER-708 only showed up with
VK_INSTANCE_LAYERS set by hand).

With LEONIDA_VK_VALIDATION=1 it now enables VK_LAYER_KHRONOS_validation and a debug messenger the
way vk_bindless_test does, prints each message to stderr and counts validation-type errors. main
wraps the old body, so every path (including errors GPU-AV reports when the queue finishes) ends
with "N validation errors" and exit 1. Without the variable nothing changes. docs/testing.md says
so, and no longer lists vk_bindless_test as a program that ignores the variable (it reads it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:51:39 +00:00
b76fb2bf1f test: pace the vk_presenter_sync step 3 worker so present() is not queued behind an unbounded backlog (TEST-875) 2026-11-22 23:49:34 +01:00
d2e989c46e Merge main into valu-int-misc (#1492)
runtime/test/shaders/check.py
scripts/run_gpu_tests.py
tests/semantic/regen_fixtures.py
tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 23:49:26 +01:00
d62694e8ce Merge remote-tracking branch 'origin/main' into pr3290-merge-main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:48:47 +01:00
ffe9b18049 Merge the D3D-45 branch (with main aa2988cc) into the D3D-60 clear branch
Main's render_target_clear_color already converts the D3D-60 integer formats and
the 10:10:10:2 alpha, so this branch now carries only its tests. The R8_TYPELESS
mapping is on main too; the duplicate case label the merge produced is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 01:47:58 +03:00
c0a92ebcfc d3d12_vulkan_device: keep main's R8 case order (merge noise)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 01:46:14 +03:00
18a785d51f Merge main (aa2988cc) into the D3D-45 clear branch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 01:45:24 +03:00
0fc8a15c56 rdna2spirv: ds_append and ds_consume (LDS)
One add / subtract of the wave's active-lane count at the offset address,
done by the first active lane; the old value to every active lane by a
subgroup shuffle (an exchange round under --wave64-emulate). Measured
natively on gfx1036: the offset alone is the address, M0 does not move it.
The gds form stays Unsupported. GPU fixtures cs_w32/w64_ds_append, semantic
test test_ds_append.py, design.md row.

AI-assisted.
2026-11-22 23:44:51 +01:00
5fec4f2827 Test a scripted 600-frame headless scene from a mapped guest 2026-11-22 15:43:53 -07:00
04be2aef15 Require the successful Vulkan factory record and share the tiny frame stub 2026-11-22 15:43:12 -07:00
f8b4f03bb7 Add native Tier 3 inner coverage reference probe
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-22 18:43:12 -04:00
d2e6b31db2 Merge commit 'aa2988cc' into d3d-417-msaa-depth-array-slices 2026-11-23 00:40:34 +02:00
9d36ec83ce d3d12: resolve a depth-only layer above 0 in a render pass (D3D-417)
AMD's Windows driver (32.0.21042.62) resolves a dynamic-rendering depth
attachment from layer 0 of the image when the multisampled view starts at
another layer, so ResolveSubresourceRegion of slice s of a 4x D32 array
gave slice 0. The same views in a VkFramebuffer of a VkRenderPass resolve
the right layer there; NVIDIA does both ways. A depth-only source above
layer 0 now takes the render pass on every GPU. Depth-stencil sources are
unchanged and still wrong on that driver.

d3d12_view_slices_test reads the 4x D32 array back on the layer and adds
views that count their slices.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 00:40:34 +02:00
8518626c1b file_system: list a GAME: folder in linear time (RT-257)
collect() probed the overlay for a deletion marker twice per package entry
(two is_regular_file calls), also when the folder has no marker folder at
all, and de-duplicated names by comparing each one with every name kept so
far. Listing 16,000 package files took 3.7 s against 9 ms on the host.

Every marker for an entry of the listed folder lives inside that folder's
marker folder, so probe it once and skip the per-entry checks when it is
missing. Keep the names seen in an unordered_set, folded with _wcslwr_s,
which follows the same locale rule as the _wcsicmp that same_name uses.

Tests: names that differ only in case are one entry with the overlay's
spelling, and a 300-file folder without a marker folder lists every file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:40:31 +01:00
0917b203b8 ps_persp_bary: judge every covered pixel, with exact coverage
Edge functions at doubled pixel-centre coordinates are exact integers, and no centre of vs_persp's triangle lies on
an edge, so the 1e-3 band that left nine covered centres unjudged is not needed. All 1158 covered pixels are now
checked; a centre exactly on an edge would be reported as a test-geometry problem. The smallest perspective/affine
gap over them is 6.4e-3, so the NoPerspective control still fails on every one. Suggested by Vonsek's independent
check in #837.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:37:52 -06:00
1291a6878c GPU tests: raw barycentrics under perspective (ps_persp_bary, vs_persp)
The raw-barycentric tests draw with vs_ids, where clip w = 1 at every vertex, so nothing checked that the raw
i/j (and the attributes) follow perspective-correct weights. vs_persp draws one triangle at screen (5,8),
(57,16), (21,55) with clip w = 1, 2, 4 and per-vertex attr0; ps_persp_bary is ps_bary's code drawn with it.
check.py's bary_persp_problem compares every pixel with CPU weights p_k = (l_k / w_k) / sum(l_m / w_m) from the
screen-space weights l_k, checks that pixels outside stay clear, and requires the affine weights to differ by
more than 100x the tolerance on every judged pixel, so a NoPerspective regression can't pass. run_gpu_tests.py
uses the same reference (PIXEL_VS, DRAWN_WITH). Suggested by Vonsek in #794.

On main it runs the native BaryCoordKHR path (it skips without VK_KHR_fragment_shader_barycentric, like
ps_bary); any barycentric fallback that lands (#804) is exercised by it too. Checked on an RX 5700 XT (RADV)
through a GS fallback: passes at wave32 and wave64; with NoPerspective on the fallback's input, all 1149
covered pixels fail while the interpolated attributes still match. New tests/test_bary_persp_oracle.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:37:21 -06:00
7a4e8d7be6 d3d12: Detile step for console-tiled layout 0x101 textures (D3D-316)
Implement GFX10 SW_64KB_D 64 KiB detiling and tiling from Mesa addrlib swizzle equations (GFX10_SW_64K_D_RBPLUS_PATINFO) with compile-time LUT coordinate evaluation. Add synthetic round-trip unit tests in resource_detile_test covering 1, 2, 4, 8, 16 BPP, sub-tile and BCn formats. Update docs/d3d12_vulkan.md.
2026-11-22 23:35:47 +01:00
b2e888f52e runtime: raise SIGABRT from the guest's abort() when a handler is installed
game_abort() ended the run directly, so a title's own SIGABRT handler never ran. Raise SIGABRT only when a handler is registered (the guest's signal() import binds to the host CRT), leaving the default and ignored cases ending with code 3 so the host is never killed. Add a synthetic fixture with handler, returning-handler, ignore and default modes plus a native-vs-loader exit-code test.

AI-assisted (OpenCode)
2026-11-23 01:31:08 +03:00
cec49b014a Tests: vk_overlapping_occlusion executes only the lists it closed (TEST-859, fails on MoltenVK)
Without pipelineStatisticsQuery the test never records or closes its two
statistics lists, but it handed them to execute(), which returns list_open.
The lists are now left out there. --no-statistics runs the test as such a
device does, and the new ctest entry vk_overlapping_occlusion_no_statistics
uses it, so the path is run on devices that have the feature.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 00:30:55 +02:00
ead8072d65 fix(xgameruntime): publish error callback + context as one consistent pair under a mutex
error_set_callback wrote g_error_context then g_error_callback into two
separate std::atomics, and error_report read them separately, so a
concurrent re-registration could pair one callback with the other's
context (RT-258 on coordination thread #3796). Guard both the read and
the write with std::mutex (already included) so error_report always sees
a consistent callback/context pair.

CPU only, no game files, no GPU. Pattern syntax-checked with g++ -std=c++17 -Wall -Wextra; full MSVC build not available locally.

Fixes RT-258 on coordination thread #3796.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-22 23:30:33 +01:00
c2f3eaa308 XDXR builder: a spare unit after BOX16 nodes (translator reads 112 bytes per box node)
tools/rdna2spirv.py's image_bvh_intersect_ray loads a box node's BOX32
bounds (112 bytes) before it selects BOX16 or BOX32, and the root is the
last node, so a BOX16 root was read 48 bytes past the structure. A BOX16
layout now ends with one zeroed 64-byte unit (MODE_INIT clears it); the
D3D12 test's BOX16 BLAS is 39,040 bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:30:14 +01:00
649a26064e XDXR builder: second review pass (refuse updates without ALLOW_UPDATE, rotation coverage, docs)
- xdxr_check refuses PERFORM_UPDATE without ALLOW_UPDATE (D3D12 requires
  it): a structure built without it may be paired, and a refit would leave
  its TRI1 children reading wrong vertices.
- blas_paired_rotations: a grid whose triangles start at varied vertices,
  so pairs use all nine (TRI0, TRI1) rotations; check-build asserts it
  ("all_rotations"). Before, the sibling rotation kd = 1 never occurred.
- BOX32 cases now say "box16": false, so a stray BOX16 is caught too.
- docs/bvh.md cites the one traced BOX16-related datum (docs/xdxr.md: a
  bottom-level path needing MINIMIZE_MEMORY and a stream value above 10),
  notes that world-space BLASes only get looser boxes; README says pairing
  saves no memory yet and the BOX16 switch is assumed; comments rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:30:14 +01:00
c42cb873dd XDXR builder: review fixes (KHR size query flag, box16 expectation, comments)
- GetRaytracingAccelerationStructurePrebuildInfo's KHR path passes
  LOW_MEMORY for MINIMIZE_MEMORY, as the build now does (Vulkan sizes a build
  with identical flags).
- check-build enforces a case's "box16" field (only BOX16 or only BOX32
  inner nodes), so a BOX16 case that came out BOX32 cannot pass the bit
  check vacuously; the vk and D3D12 BOX16 cases set it.
- Comments: half_round's inward overflow, the remap byte's positions, what
  the half-rounding table test covers, and what an update that breaks
  D3D12's flag or ALLOW_UPDATE rules would do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:30:14 +01:00
756e5238ed xdxr_build.inc: regenerate from xdxr_build.comp (TRI1 pairing)
glslc --target-env=vulkan1.2 -O -mfmt=c xdxr_build.comp -o xdxr_build.inc

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:30:14 +01:00
b8c07f8ccf XDXR builder: pair sibling triangles into TRI0/TRI1 leaves
A bottom-level build without ALLOW_UPDATE now pairs triangles, as the
console builder does in its offline BLASes. The pass that writes the nodes
above the leaves pairs a triangle with a later sibling (among that node's at
most four children) that shares an edge in the opposite direction (the same
vertex bits), from the same geometry, both active. The first triangle is
rotated to put the shared edge in slots 1 -> 2, the sibling's third vertex
goes in slot 3, its primitive in PrimitiveIndex2, and each node type's remap
byte returns D3D12's barycentrics for its own vertex order.

The node keeps one child per triangle with its own box, so the tree, the
layout and the sizes do not change; the TRI1 child points at the first
leaf and the sibling's leaf is left unused. Pairs never cross nodes: one
thread owns each rewritten leaf and each parent-table entry. A refit
rewrites the leaves one triangle each, so the layer does not pair builds
with ALLOW_UPDATE (xdxr_pair), and record_blas ignores `pair` for updates.

check-build now compares barycentrics as well as hits, and checks a case's
"pairs" field: at least one TRI1 node, or none. New cases: paired grids
(BOX32 and BOX16), a transform, a mixed scene, the radix path, and two that
must not pair (pairs split across geometries, edges shared in the same
direction), plus a D3D12 BLAS without ALLOW_UPDATE. Mutating the geometry or
the direction rule, or the remap byte, fails check-build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:30:06 +01:00
a3d682840f xdxr_build.inc: regenerate from xdxr_build.comp
glslc --target-env=vulkan1.2 -O -mfmt=c xdxr_build.comp -o xdxr_build.inc
(Vulkan SDK 1.4.363.0's glslc; it reproduces the previous blob byte for byte
from the previous .comp).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:29:53 +01:00
00c63805c2 XDXR builder: BOX16 inner nodes for MINIMIZE_MEMORY bottom-level builds
A bottom-level BuildRaytracingAccelerationStructure with MINIMIZE_MEMORY now
writes BOX16 inner nodes (64 bytes, half boxes) instead of BOX32 (128 bytes):
the same tree, about a fifth smaller. Prebuild info, the build and its refits
take the choice from the same flags (xdxr_box16), so the sizes stay exact.
Top-level builds keep BOX32 (world space: a half's step is 2 m at 2 km).

Each child box is rounded outward from the exact box kept in scratch, in
integer code (packHalf2x16's rounding is implementation-defined; AMD rounds
toward zero). Past the half range a bound goes to +-inf outward and +-65504
inward, so empty slots stay empty; below the smallest normal half it goes to
0 or +-2^-14, never a denormal a flushing decoder would shrink.
tools/xdxr_bvh.py half_round gets the same denormal rule, and check-build now
compares every BOX16 word bit for bit with encode_box16 of the exact box of
the triangles under it.

Tests: five blas_box16_* cases in vk_xdxr_build_test (radix and small sort,
an inactive triangle, values past 65504 and below 2^-14, a refit), and a
MINIMIZE_MEMORY BLAS plus its in-place update through the D3D12 API in
d3d12_xdxr_rt_test (prebuild and postbuild sizes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:29:47 +01:00
0ee1deff2c d3d12: create_window_presenter looks behind the Xbox device proxy (D3D-414)
A title holds the Xbox-ABI proxy, and create_window_presenter looked up the
layer's device on the pointer it was given, so with the proxy it returned null
and logged nothing. It now resolves the proxy first, as the helpers around it
do, and says on stderr when it is handed a device that is neither.

xbox_present_test creates a presenter from the proxy and presents a blank
frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:27:15 +00:00
34c130c36c docs: slot 67 passes the dispatch state on; what pipeline slot 11 does with 0, measured (RT-99)
- d3d12_command_objects.md section 3.5a: slot 67 now passes all four pairs; for slot 11, what the DLL does on failure
  and with 0 (measured in its code), the object's shape, why no program needs a scratch size (measured over the 29),
  what is implemented and what stays open.
- fspx.md: the slot-67 payload and its checks, and slot 11.
- d3d12_vulkan.md and runtime/README.md: the new parts of d3d12_fspx_compute_test; the DLL's own dispatch was not run
  here (fsr_dispatch_test needs MSVC structured exception handling).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:26:34 -05:00
bcf3cd47f5 FidelityFX pipelines: slot 67 passes kind 0 on, and the compute pipeline answers console slot 11 (RT-99)
After slot 67 (or 62) creates a pipeline, amd_fidelityfx_upscaler_xbox.dll calls the pipeline's slot 11, past the
public ID3D12PipelineState, and the slot-67 mapping dropped the dispatch state, so two programs with the same code and
different kind 0 could not be told apart there.

- d3d12_xs_device.cpp: with kind 0 present (the DLL always passes it), slot 67 builds one FSPX payload from the four
  pointer and size pairs (leonida::fspx_payload_from_parts) and passes it as CS, so the device uses the code and
  state keys. Every pair is checked before it is read; an inconsistent one refuses the call. Without kind 0 the
  kind-6 bytes go on alone, as before.
- d3d12_vulkan_device.cpp: XboxPipelineStateStubs puts console slots 9, 10 and 11 into the pipeline's vtable ahead
  of Object's virtual destructor (one slot under MSVC, two under GCC), so they are slots 9 to 11 on both. Slot 11
  returns a blob holding 0; 9 and 10 return E_NOTIMPL.
- Why 0, measured on 1.0.2.1: the DLL zeroes the value before the call, keeps it at 0 when slot 11 fails or returns
  no object, and with 0 skips the scratch buffer and list slot 141 at dispatch. None of the 29 programs sets
  COMPUTE_PGM_RSRC2.SCRATCH_EN or has a scratch instruction, and kind-0 words 0 to 2 are the same in all 29, so no
  per-program scratch size is there.
- Tests: shader_library_test (payload building, refused pairs, the #1911 review case through slot-67 parts) and
  d3d12_fspx_compute_test (slot 67 with four pairs picks the right one of two programs sharing their code, bad pairs
  refused, slot 11 and its object's slot 3 and 4, reference counts unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:23:49 -05:00
d61278421b d3d12_boot_movie: a real boot-splash frame through the present path
Decode two frames of a real startup movie through the package's own
Bink2Scarlett.dll (rt::Loader), upload each BGRA frame to a committed
ALLOW_DISPLAY texture through the Xbox-ABI proxy, present it with PresentX and
compare the captured swapchain image with the decoded frame: both frames are
bit-exact at 1:1 (8,294,400/8,294,400, worst 0), centre and corners included,
and the two presented frames differ (24,833,045/33,177,600 bytes).

The test is Windows-only and skips (77) without LEONIDA_GAME_DIR and
LEONIDA_MOVIE; it prints only the movie's properties and writes nothing, so no
game data can enter the repository. CTest entry d3d12_boot_movie.
2026-11-22 19:22:40 -03:00
3c7500b580 Exercise translated raster draws from a mapped synthetic guest 2026-11-22 15:22:19 -07:00
2fb013cd9b Merge origin/main into tls-existing-threads
Conflicts with #2070's later round (TLS generations, per-slot thread-event
errors, clone purge) in pe_loader.cpp/.h and loader_tls_test.cpp:
- install_thread_block keeps main's generation check and this branch's
  existing-thread check.
- on_host_thread_event keeps main's per-slot try/catch and calls this
  branch's existing-thread hooks first, each in its own try/catch.
- ~Loader resets the slot generation and removes the existing-thread blocks.
- The existing-thread records carry the module's TLS generation too.
- Both sides' tests stay. test_orphan_slot_generation_reuse now expects
  one DLL_THREAD_DETACH, not none: the worker was running when the second
  Loader mapped the module, so it gets that module's copy and its detach,
  as Windows does; a second detach would mean the orphaned record was taken
  for the new module's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:19:40 +00:00
ed91cd250a Tests: GPU checks for v_med3_f32/f16 with a NaN in S2 or in two operands
ps_fnan_med3 puts its NaN in S0 only, so no GPU test reached the cases
ps_fnan_med3_s2 (f32) and ps_f16_fnan_med3 (f16), with inputs read from
memory at run time and words derived from the measured rule in
docs/design.md (with any NaN operand, med3 is min3 with the NaNs
ignored). The all-NaN case is left out: its payload is not modelled.

Registered in check.py and run_gpu_tests.py; the semantic fixtures and
GpuFixtures tests run them through the interpreter, where the
translator before #2029 fails them (undefined FClamp on a NaN).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:18:01 +01:00
9c2eaaafe7 Runtime: compare castable-list clears with WARP within 1
The castable cases in d3d12_clear_test compared each byte with WARP
exactly. Drivers round the 0.5 tie differently (WARP stores 128, NVIDIA
127), and Intel's driver encodes sRGB 1 off WARP in places, where its
own D3D12 driver stores the same bytes as the layer (measured on a UHD
770 and an RTX 4070 SUPER in the review of this change). Compare within
1, as the castable draws in d3d12_draw_test do: a wrong channel order or
a missing sRGB encoding is many steps off, so the cases still catch what
they test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:15:48 -03:00
6da1c717fc Merge main into hw-mad-u32-u16 (#2494)
docs/design.md
tests/semantic/regen_fixtures.py

AI-assisted.
2026-11-22 23:15:36 +01:00
afd5304c61 Tests: depth resolves of D32S8, and of samples that differ (TEST-847, TEST-848)
d3d12_depth_resolve_test now takes D32_FLOAT_S8X24_UINT through the same cases
as D24S8: either plane by the depth-stencil format, the depth plane by
R32_FLOAT_X8X24_TYPELESS (MIN, MAX, AVERAGE) and the stencil plane by
X32_TYPELESS_G8X24_UINT, an R32G8X24_TYPELESS resource, and the refusals
(AVERAGE by the D32S8 format or of stencil). The readback tells a 24-bit UNORM
depth plane from a float one by format, not by "has stencil".

Every case also runs as an edge case: a triangle drawn over the cleared 4x
source with a depth-only PSO (depth 0.5, stencil 0x44 REPLACE, test ALWAYS)
leaves the pixels its diagonal edge crosses with samples that differ, so
MIN, MAX and AVERAGE reduce over different values. There is no CPU model of
the coverage: the layer must match the PC runtime byte for byte, and MIN and
MAX of each edge case must differ somewhere. The layer's VS is a GLSL stand-in
(test/glsl/vs_depth_edge.vert) behind a synthetic FSSM container; the host's
is HLSL compiled by d3dcompiler_47. Without glslangValidator the edge cases are
skipped and the summary says so.

RTX 5070 (621.01), Windows 11, validation on: 97 of 97 cases match the PC
runtime on the default adapter, 71 of 71 on WARP, 20 edge MIN/MAX pairs differ.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:15:34 -06:00
dc01a17397 gameinput: report SDL's effect result from gameinput_probe (RT-160)
`--force-feedback` now reads the shim's output state once the poll thread has
picked the effect up, and says whether SDL created it and is running it, or why
it did not, so a wheel owner can tell a silent drop from a real run. The shim
records SDL_CreateHapticEffect's id, SDL_RunHapticEffect's result and SDL's
error text per device; gameinput_test asserts the success and the refusal.

AI-assisted
2026-11-22 23:15:09 +01:00
cd30309409 Merge main into gpu-vopc-int (#2220)
tests/semantic/regen_fixtures.py

AI-assisted.
2026-11-22 23:12:43 +01:00