Commit Graph

4163 Commits

Author SHA1 Message Date
41e3bc0fd0 M3 (synthetic): d3d12_m3_frame_test, MRT + D24S8 + occlusion + barriers + SRV pass, three frames in flight
Six frames through a ring of three slots, each with its own fence. Pass 1 draws
three rectangles (translator-output vs_m3/ps_m3) into an RGBA8 and an R32F
target with depth LESS/write and stencil REPLACE/EQUAL, the far one inside an
OCCLUSION query; barriers move the targets to shader/copy-read states; pass 2
samples the first target through an SRV descriptor table. Every pixel and the
exact sample count match a CPU reference. No layer change was needed. Render
passes (D3D-27) stay open. The generic shader harness skips the fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:59:57 +01:00
6d642f40f9 GPU test cs_w32_salu64: 64-bit scalar data ops and v_mad_u64_u32
s_brev_b64, s_bfe_u64/i64, s_bitset1_b64, s_flbit_i32_b64/i64, s_cmov_b32
(with s_sext_i32_i16) and v_mad_u64_u32 were added with semantic tests
only. cs_w32_salu64.asm has lane 0 of a wave32 group store one word of
each; check.py and run_gpu_tests.py expect the eight words (derived in
the .asm header), so CI runs it on llvmpipe.

tests/semantic/test_salu64_fixture.py runs the fixture on the CPU,
checks the words against values computed from the ISA definitions, and
that both GPU runners expect the same words.
2026-11-22 08:58:01 -03:00
f1918a31df Merge main into test/coverage-gaps (#1299)
Conflicts were all list/registration hunks in check.py, run_gpu_tests.py, regen_fixtures.py and test_value_semantics.py; kept main's side and re-added only this PR's entries.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:57:00 +01:00
d55fa3d4d1 Translator: image_bvh triangle nodes read their type's vertex slots and the barycentric remap byte
image_bvh(64)_intersect_ray followed RADV's software path on triangle nodes,
which always reads vertex slots 0, 1, 2 and returns (v, w): RADV builds one
triangle per node. The hardware format packs up to four triangles per node,
and the node type picks the slots: TRI0 (0,1,2), TRI1 (1,3,2), TRI2 (2,3,4),
TRI3 (2,4,0). The type's byte of the triangle-ID word at +60 picks which two
vertex weights come back (bits [1:0] and [3:2]; 0x09 is RADV's v, w). A BVH
with paired leaves therefore traversed TRI1 against the wrong triangle.

Both rules come from AMD GPURT (CalcTriangleCompressionVertexIndices,
SwizzleBarycentrics, TRIANGLE_ID_I/J_SRC_SHIFT), and the public XDXR software
path (Read3Verts, TestXboxBvh4Leaf) agrees with it.

- tests/semantic/test_image_bvh_tri.py: every node type on a hand-built node,
  every remap selector pair, the byte per type, selector 3, a zero word
- spirv_mini_interp: OpVectorExtractDynamic and GLSL.std.450 FSign, from the
  specifications
- vk_compute_test "bvh": its hand-built triangle nodes now carry the 0x09
  triangle ID a builder writes; expected words unchanged
- docs/design.md Ray tracing row, docs/bvh.md 7a, translator docstring

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:56:07 +01:00
e49a735134 fix(pe_loader): validate SizeOfHeaders covers NT/section headers and guard truncated relocation blocks 2026-11-22 08:55:31 -03:00
6728a00c2a PresentX: implement ImmediateThresholdPercent with VK_KHR/EXT_swapchain_maintenance1
A frame presented after the vblank it was due at is flipped at once (IMMEDIATE, else
FIFO_RELAXED) when the scan would be within the threshold percentage of the screen,
instead of waiting a whole interval. The decision is the pure
leonida::decide_present_sync(late_us, interval_us, threshold); FramePacer reports the
lateness against the vblank after the token's origin and records the tear in
GetFrameStatisticsX (PercentScanned) and immediate_presents().

VulkanPresenter creates a vsync swapchain with FIFO plus the tear mode when the surface
lists it as compatible (VkSurfacePresentModeCompatibilityKHR) and chains
VkSwapchainPresentModeInfoKHR on a tearing present. The device enables the KHR (else EXT)
extension, its feature and the matching instance extensions only where present; without
them the threshold is ignored and logged once, as before. LEONIDA_PRESENT_NO_TEAR=1 turns
it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:54:49 +01:00
eef61a04c0 test: a mapped program reaches xgameruntime.dll through LoadLibraryW, as GDK titles do
#1384 made the loader answer LoadLibrary/GetProcAddress for shim-owned modules, because the package's GDK
modules load xgameruntime.dll at run time instead of importing it. Only a registry-level unit test covered
it. tiny_gdk_load.exe has no xgameruntime.dll import and does what xgameruntime.lib's thunks do:
LoadLibraryW, GetProcAddress of the five entry points, InitializeApiImplEx2, QueryApiImpl for XThreadingImpl
and UninitializeApiImpl. ctest run_tiny_gdk_load runs it under gta6rt --run, so its own kernel32 imports go
through the loader's binding, and checks the verdict from outside as run_tiny_async does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:53:47 +00:00
170dc22518 Runtime: resolves inside a pipeline-statistics query (D3D-162)
Replay refused binary occlusion resolves, and ordinary resolves that need a sum, while a pipeline-statistics
query was active: their compute helper would count in the application's CSInvocations.

A statistics query that contains a resolve (other than a timestamp copy) is now split. Its counters go to
physical PIPELINE_STATISTICS segments in a pool of the submission's own (flags 0x7ff, as the device creates
the heap). A segment ends before each such resolve and the next begins after it, so no helper dispatch runs
inside the application's query. The query's result is the sum of its segments: a new 11-counter compute shader
(statistics_sum.comp, encoded in statistics_sum_spirv.h like the occlusion helpers) adds them on the
occlusion-resolve scratch buffer. That sum is a helper dispatch too, and is kept out of any statistics query
still running by the same split. Whether a resolve dispatches is only known when the list is planned against
the heaps, so every such resolve splits the query.

The single-list replay() has no segment pool. It keeps refusing a resolve that dispatches inside statistics,
and now allows a binary resolve that only writes zeros. SetPredication and predicated copies are still refused
while statistics are active.

Tests, all with the Khronos validation layer on:
- vk_binary_occlusion: a binary resolve inside one statistics query, then the statistics sum of that query
  inside a second one. Every counter of both is 0. With the split disabled, CSInvocations reads 64.
- vk_overlapping_occlusion: a 261-segment occlusion sum inside a statistics query, with a native draw in each
  segment. The split query, and a second one split around the statistics sum, equal two unsplit queries with the
  same draws on every counter, and CSInvocations is 0.
- replay_query_predication (CPU): the exact begin/end/dispatch order of a split query, and the refusal without a
  segment pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:51:45 -03:00
5c9315d971 Test tools: turn MoltenVK fast-math off so NaN compares are exact (SHADER-234)
MoltenVK compiles MSL with Metal fast-math on by default, and Metal then folds
an f32 compare of a NaN with itself: v_cmpx_eq/le_f32 on (NaN, NaN) give true
(ps_vcmpx_forms fails on every Mac). The MSL is byte-identical with fast-math
on and off, so it's Metal's compile option, not the translation; "on demand"
(2) doesn't help, 0 does.

runtime/test/vulkan_loader.h, which every Vulkan test program loads MoltenVK
through, now sets MVK_CONFIG_FAST_MATH_ENABLED=0 before loading it unless the
variable is already set. docs/design.md gets a contract row: fast-math off
doesn't remove the optnone NoContraction helpers (the cost part, @Jolymmiles)
and doesn't fix SHADER-182 (same valu_fuzz f16 mismatch either way).

Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_vcmpx_forms 4096/4096 exact;
run_gpu_tests.py 85 pass/52 skip/2 fail -> 86/52/1 native, 114/23/2 ->
115/23/1 with wave64 emulation (the remaining failure is ps_interp_f16_high,
fixed by #1407); ctest 25/25 either way; semantic suite 1220 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
2026-11-22 14:48:31 +03:00
00d9634ac7 d3d12 FORMAT_SUPPORT test: integer resolves only; guard the depth MSAA query
Which float formats resolve is up to the GPU (the RX 9070 XT's driver
reports no R9G9B9E5 resolve, WARP does), so the host comparison only
checks the rule the layer implements: no resolve of UINT/SINT formats.
The depth-stencil multisample query checks image_format_properties like
the other calls do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:46:48 +01:00
c4e08989d7 M2 review: run_gpu_tests skips ps_m2/vs_m2, replay refuses set-0 pipelines without bind_descriptor_sets, test includes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:46:14 +01:00
5624023225 test: avoid NaN-sensitive framebuffer outputs (TEST-206) 2026-11-22 13:45:51 +02:00
196d200242 d3d12: D24 format support and MSAA levels describe the D32 image creation makes
On a GPU without Vulkan D24_UNORM_S8_UINT (AMD), a D24 texture is a D32_SFLOAT_S8_UINT image (#737), but
CheckFeatureSupport answered from the D24 format itself: FORMAT_SUPPORT gave Support1 = 0 for
D24_UNORM_S8_UINT and R24G8_TYPELESS, and MULTISAMPLE_QUALITY_LEVELS gave 0 levels for R24G8_TYPELESS at
every count, while CreateCommittedResource(ALLOW_DEPTH_STENCIL) succeeded (found by @zneel, #1380 item 2).

- FORMAT_SUPPORT queries D32_SFLOAT_S8_UINT when the format resolves to D24 and the device can't use D24.
- MULTISAMPLE_QUALITY_LEVELS takes the creation path for typeless formats that are only valid as depth.
- d3d12_d24_support_test checks the layer against itself on any GPU: DEPTH_STENCIL is reported exactly when
  a 1x depth-stencil texture is created, and a quality level exactly when a 2x/4x/8x one is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:43:54 +00:00
2ea73b2522 GPU test for v_mad_u32_u16, v_mad_i32_i16 and v_subrev_f16
Two pixel tests for ops that had CPU checks only. ps_valu16_mad: the u16
product plus S2 wraps at 32 bits, i16 sign-extends (also op_sel high
halves), and the destination dword is overwritten. ps_valu16_subrev:
S1 - S0 in _e32 and _e64 (neg, clamp) with the destination high half
kept. Registered in check.py and run_gpu_tests.py and added as semantic
fixtures with hand constants and a Python reference.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:43:47 +01:00
452fb3f9a8 GPU tests for misc 32-bit integer VALU ops (ps_vint_*)
Five pixel fixtures, inputs from memory, for v_add_lshl_u32, v_and_or_b32,
v_xor3_b32, v_bfi_b32, v_bfm_b32, v_bfrev_b32, v_mad_i32_i24,
v_mul_hi_u32_u24, v_max3_u32, v_min3_i32 and v_max/min_i32/u32. Operands
cover 24-bit sign extension with garbage in bits 24-31, shifts and field
sizes of 32 and more, and signed vs unsigned min/max. Expected words are
derived in the .asm headers; the same shaders are semantic fixtures.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:43:43 +01:00
810acc75fe Merge origin/main into m2-textured-draw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:42:47 +01:00
9a08a6d706 d3d12: FORMAT_SUPPORT follows D3D12's per-format rules
The layer turned Vulkan feature bits straight into D3D12 support bits. On an
RX 9070 XT that disagreed with native D3D12 on the same adapter in 169
reported-but-absent bits and 761 absent-but-native ones. This change only
reports what the layer provides:

- UAV_TYPED_LOAD with every typed UAV (reads use the sampled binding), not
  from STORAGE_IMAGE_ATOMIC; the UAV atomic bits other than exchange for
  R32_UINT, the format with the r32ui storage view
- MIP where the image can have mips; SHADER_GATHER with SHADER_SAMPLE;
  MULTISAMPLE_RENDERTARGET for depth formats
- no integer MULTISAMPLE_RESOLVE, no 1D block-compressed, no 3D or shader
  reads of depth formats, and TYPELESS formats report only texture
  dimensions and MIP

d3d12_vulkan_device_test compares these format-defined bits with native
D3D12 on the same adapter: 0 mismatches over 78 formats with this change,
249 on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:42:00 +01:00
017d260438 fix(runtime): bind single-layer Texture1D shader-resource views
The device can allocate 1D textures and set 0 has a sampled 1D binding, but default and explicit views previously sampled the fallback. Use the texture dimension and the requested mip range when registering the view.
2026-11-22 12:38:59 +01:00
c12368e701 Merge pull request #1472 from Dominik 2026-11-22 06:38:11 -05:00
ad64720b5a Merge pull request #1464 from totonii 2026-11-22 06:38:10 -05:00
38b7b9a663 Merge pull request #1461 from Vonsek 2026-11-22 06:38:09 -05:00
afaf5b0c15 Merge pull request #1450 from Vonsek 2026-11-22 06:38:07 -05:00
d6d5117244 Merge pull request #1440 from IAmNotSiob 2026-11-22 06:38:04 -05:00
0b6e9952d4 Merge pull request #1432 from Emre Demir 2026-11-22 06:38:02 -05:00
db83d7a707 Merge pull request #1424 from Ryderadzeee 2026-11-22 06:38:00 -05:00
f4e0f706e1 Merge pull request #1407 from Hamza 2026-11-22 06:37:56 -05:00
923993c1c7 Merge pull request #1405 from Vonsek 2026-11-22 06:37:55 -05:00
7e47b12789 Merge pull request #1378 from Emirhan Karaca 2026-11-22 06:37:54 -05:00
48389a8f21 Merge pull request #1357 from totonii 2026-11-22 06:37:54 -05:00
650ea999a6 Merge pull request #1083 from abilliontokens 2026-11-22 06:37:53 -05:00
ddcff1fcdd Merge pull request #965 from omardev29 2026-11-22 06:37:53 -05:00
faa57e52ad bvh_builder_test: use WARP on every hardware vendor by default (RT-89)
RT-54 switched to WARP only on NVIDIA (PCI vendor 0x10DE). AMD faults the same way: on an RX 7900 XTX the
XboxBvhBuilder constructor ends with 0xC0000005 right after the first slot 62 call (found by
@ThatZaliaSGuy, #166). The test now uses WARP whenever there is a hardware adapter, prints the vendor id it
skipped, and LEONIDA_BVH_HARDWARE=1 still keeps the hardware device. docs/d3d12_vulkan.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:36:34 +00:00
40f239be13 M2: pipelines bind the bindless set 0; textured quad through the descriptor path (d3d12_m2_textured_test)
Pipelines (graphics and compute) whose translated shader declares set-0 bindings were refused. Their layout now
holds the device's bindless set 0 and replay binds it at every draw and dispatch. d3d12_m2_textured_test drives
heaps, SRVs, a POINT sampler, two root descriptor tables and DrawIndexedInstanced with a translated PS that
loads the T#/S# from the tables; 4096 of 4096 pixels match, and the descriptor hash table is checked.
d3d12_translated_draw_test is registered with ctest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:34:41 +01:00
e1b3fca96d Runtime: depth <-> colour copies through a scratch buffer
CopyResource and CopyTextureRegion between D32_FLOAT and R32_FLOAT/UINT/SINT,
and between D16_UNORM and R16_FLOAT/UNORM, were refused at execution because
vkCmdCopyImage cannot mix a depth and a colour aspect. Host D3D12 and WARP
copy the bits, and #1134 listed these as not covered.

The replay now stages each such region image -> scratch buffer -> image.
The scratch comes from a new ScratchBuffers pool (vulkan_scratch.h):
device-local chunks handed out while a list is prepared and retired with
the submission's timeline value, like the depth24 converter's scratch, but
enabled on every GPU. Without it the copy is refused as unsupported before
anything is written.

Still refused: depth with stencil (two planes), D24 stored as D32, and
multisampled textures.

Tests: d3d12_copy_xfmt gains five depth <-> colour cases (R16 -> D16 both
ways, D32 -> R32_UINT, three mips, and a D32 -> R16 negative control), and a
depth <-> colour mismatch now fails it. vk_command_replay_test part H runs a
D32 -> R32 -> D32 round trip through the replay, and checks that a list is
refused with no scratch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:33:50 +02:00
449cb7b460 fuzzers: skip wave32 runs vk_compute_test could not pin to 32 lanes
valu_fuzz.py, lds_fuzz.py and crosslane_fuzz.py ask vk_compute_test for
32-lane subgroups (VKC_SUBGROUP_SIZE=32) for wave32 programs, but they
ignored its "compute subgroup size: 32 not available" line. On a device
that can't pin that size (Mesa llvmpipe: 8 lanes) every wave32 program
was judged at the driver's size and its cross-lane results came out as
translator mismatches. On main f85582e with llvmpipe, lds_fuzz --emulate
--programs 400 --seed 5150 gave 215 mismatches, all wave32, and
crosslane_fuzz --wave 32 --no-maskdata gave 68 of 100.

Those wave32 programs are now skips, as check.py's unpinned_subgroup_skip
does for its lane-mask dumps. Programs translated with --wave64-emulate
use no subgroup operations, so they are still compared at any size
(400 of 400 match on llvmpipe). crosslane_fuzz counts the skips in its
summary and exits 2 when every program was skipped, as the other two
fuzzers already do.

The line is parsed by compute_fixture.unpinned_subgroup, shared by the
three fuzzers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:33:45 +00:00
05e2e39db9 perf(vulkan): zero-copy DescriptorTable staging upload and uint32 wrap guard in read_slots 2026-11-22 08:33:44 -03:00
1681f3dc1e Translator: --f16-interp-fallback reads f16 halves without PerVertexKHR (SHADER-196)
MoltenVK can't compile PerVertexKHR to MSL, so ps_interp_f16_high failed at
pipeline creation on every Mac. With --f16-interp-fallback every VS/mesh param
(and the --mesh-compute VS) also exports its two f16 halves decoded to f32,
low halves at location 29 - 2N and high halves at 30 - 2N, and a PS *_f16 read
takes them as ordinary smooth inputs. A producer skips halves that would land
on its own params; a PS whose half location is also an attribute is rejected.
The index records f16_halves on both sides.

tools/vk_subgroup_info.py reports per_vertex_inputs (false without
fragmentShaderBarycentric or on MoltenVK); make_game.py and run_gpu_tests.py
turn the flag on where it is false. Without the flag all 139 GPU-test modules
are byte-identical to main's, so NVIDIA/AMD keep the exact per-vertex path.

Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_interp_f16_high passes, all
4096 pixels bit-exact; run_gpu_tests.py 84 pass/50 skip/1 fail -> 85/50/0
native, 112/22/1 -> 113/22/0 with wave64 emulation; ms_f16_pack passes through
--mesh-compute. Semantic suite 1194 -> 1203 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
2026-11-22 14:32:28 +03:00
5e91fb9af2 Merge main into test-184-image-ops
main is at bb2e1842. Three conflicts, both sides kept:

- runtime/test/vk_store_test.cpp: main added the "load-d16" mode (a row of
  16-bit boundary values in the fill, for the saturating d16 loads) and
  VK_KHR_shader_fma support; this branch added the "words" mode. Both modes
  and both includes stay; main's boundary row applies to "load-d16" only, so
  "words" keeps the plain fill its expected words are derived from.
- runtime/test/shaders/check.py: main lengthened CS_STORE on the line next to
  this branch's cs_bvh32 entry. Both lines.
- tests/test_shader_checks.py: main counts cs_fma_fused (8 -> 9) on the line
  after this branch's STORE_WORDS and GET_LOD_TESTS terms. Both.

The automatic merges were read as well: vk_compute_test.cpp keeps the larger
bvh heap next to main's shader_fma code, and check.py and run_gpu_tests.py
run cs_imgload_d16 in "load-d16" next to the "words" fixtures.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 06:31:49 -05:00
ade4aa0b24 fix(d3d12): report usable single-sample RGB9E5 render targets
After the native attachment and feature-mask changes merged, Radeon could create and clear the resource despite a negative capability query. Check the advertised bit against the physical attachment capability before a focused test can skip.
2026-11-22 12:31:00 +01:00
6c44492e33 fix(shader): saturate UINT formatted buffer stores
Narrowing a channel to an eight- or sixteen-bit UINT field must clamp high values before packing. Native RDNA2 returns all ones for an overflowing field, while masking wrapped it to the low bits.
2026-11-22 12:30:54 +01:00
624f42e23b Runtime: apply backing-buffer end size to rgb96 CopyTexture 2026-11-22 14:30:52 +03:00
ba4687404d Merge origin/main (bb2e1842) into d3d90-castable-placed
Third merge round (118 commits): D3D-97's per-queue priorities keep the
GPU address arena's bufferDeviceAddress enable; main's VK_KHR_shader_fma
probing chains after the PR's PSO feature enables; the backing-offset and
hardened whole-buffer-copy refactors replace the PR's older lines.
2026-11-22 03:30:40 -08:00
4def9b297b GPU test cs_w32_int_ext: integer ops that only had CPU checks
s_absdiff_i32, s_lshl2_add_u32 (and the SCC of s_lshl1_add_u32),
s_pack_lh_b32_b16, s_mul_hi_i32, v_mul_hi_i32_i24, v_sad_u8 and v_lerp_u8 were
added with semantic tests only. cs_w32_int_ext.asm has lane 0 of a wave32
group store one result of each; check.py and run_gpu_tests.py expect the
eight words (derived in the .asm header), so CI runs it on llvmpipe.

tests/semantic/test_int_ext_fixture.py runs the fixture on the CPU, checks the
words against values computed from the ISA definitions, and that both GPU
runners expect the same words.
2026-11-22 08:29:52 -03:00
c8c640059d loader_tls_test: the thread that outlives its Loader belongs to an initialised module
With initialise() run, the module's TLS callbacks take thread events, so the
thread that ends after ~Loader has delivered the process detach and unmapped
the image checks that no DLL_THREAD_DETACH callback runs into freed memory.
2026-11-22 12:29:52 +01:00
b4d7f7b279 tiny_game: opt-in checks by argument, and a CTest run for each
The thread_local and C++ exception checks were switched on by LEONIDA_RUN_TLS=1
and LEONIDA_RUN_EH=1. scripts/run_wine_tests.py passes a test's command line but
not its ENVIRONMENT property, so under Wine an environment-based test would only
ever see the SKIP path. They now take arguments after "hello 42" (`tls`, `eh`),
and CTest runs each in its own test, run_tiny_game_tls and run_tiny_game_eh.
run_tiny_game keeps running without them. stdout is unbuffered, so a crash still
shows how far the run got.
2026-11-22 12:29:52 +01:00
21b920bfb0 loader_tls_test: thread events after initialise() and a thread that outlives its Loader
tiny_tls counts DLL_THREAD_ATTACH/DETACH only for a thread the test names, so
threads the process starts for itself can't change the counts; the test starts
that thread suspended and names it before it runs. Checks: one attach before the
thread's code runs, with the template value already readable in the callback;
one detach when it ends; and a thread that is still running when its Loader is
destroyed gets its copy freed when it ends, with the process carrying on.
2026-11-22 12:29:52 +01:00
e5d44d4b0f Loader: give every thread started after load() its own TLS copy
Until now only the thread that called load() had the mapped image's TLS; any
other thread read gta6rt_tls_host.dll's block through _tls_index, so a
thread_local on the game's own threads (gta6rt runs the entry point on a new
thread) started from the wrong data: tiny_game's thread_local check fails on
main with LEONIDA_RUN_TLS=1.

The loader now registers for the helper's thread events. On DLL_THREAD_ATTACH
the new thread gets a fresh copy of the template in the reserved slot; on
DLL_THREAD_DETACH the helper's own block goes back before the Windows loader
frees the array. Once initialise() has run the module, the events also run its
TLS callbacks (as Windows does: thread events only after DLL_PROCESS_ATTACH),
with the copy already in place.

An SRW lock orders the owner's publication, its initialised flag and its
retirement in ~Loader against the events, which run under the loader lock; the
exclusive sections only write fields. ~Loader retires the owner before
uninstalling, so a thread that outlives its Loader frees its copy from its own
record without touching the freed Module. Module::tls_block stays the loading
thread's copy, now set by initialize_tls only. install_tls_for_thread remains
for threads that existed before load(); on a thread that already has the copy
it is a no-op, which the updated worker check shows.
2026-11-22 12:29:51 +01:00
1387865c3a merge: cover wide sample inputs after D16 saturation reaches main
Use the current common image packer and its boundary-value fixture for the sample shader. Keep the merged explicit-gather paths and the headless presentation skip.
2026-11-22 12:29:49 +01:00
aa2190bacb Trim comments 2026-11-22 12:29:31 +01:00
09ba78556a D3D12 device: host-like answers for meta commands, CheckDriverMatchingIdentifier and RemoveDevice
These ID3D12Device5 methods are on the 'not planned until the game's trace shows
them' list and were still generated E_NOTIMPL stubs. Answer them as D3D12 does on
a device without the feature (and as vkd3d-proton does):

- EnumerateMetaCommands: no meta commands (count 0, S_OK; null count E_INVALIDARG)
- EnumerateMetaCommandParameters / CreateMetaCommand: unknown command, E_INVALIDARG
- CheckDriverMatchingIdentifier: UNRECOGNIZED for serialized acceleration
  structures, UNSUPPORTED_TYPE for any other type
- RemoveDevice: GetDeviceRemovedReason reports DXGI_ERROR_DEVICE_REMOVED afterwards

Tested in d3d12_vulkan_device_test (RemoveDevice on a device of its own).
2026-11-22 12:26:23 +01:00