Commit Graph

4696 Commits

Author SHA1 Message Date
4f4cc860ad Match DXGI on an out-of-range GetBuffer index 2026-11-22 22:34:58 +04:00
2426df3d5e GPU tests: wire cs_fma_fused in run_gpu_tests and accept GLSL Fma split on RADV 2026-11-22 18:34:11 +00:00
8d9a50759a fix(process): close g_done race, guard CreateEventW, and preserve ExitThread code in run_entry 2026-11-22 15:34:07 -03:00
70c1c54cbf Merge origin/main into buffer-formats-all-v2
Conflicts in tools/rdna2spirv.py and docs/design.md. Main had meanwhile fixed three of the older
stores this branch found (SHADER-358: f16 toward zero; SHADER-364: exact NORM rounding and the
DST_SEL-dependent routing of a two-component format), so the merge keeps main's mem_f16,
encode_norm_bits and 2-component swizzle, applies them to the new SCALED kinds as well, and passes
the swizzled channels into the shared typed-store encode function (Gen.format_encode_call, now 29
parameters). Gen.norm_encode_exact and EXACT_NORM_CODES go: encode_norm_bits does the same job.
The three expectedFailure tests pass now and pin the older stores to the oracle's words; cs_fmt_all's
16_16_SINT store is (x, 0) through its identity-selector V#. design.md keeps one Typed buffer formats
row; test_buffer_store_format's unsupported-format example is BUF_FMT_INVALID (8_USCALED is
supported now).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 19:33:56 +01:00
98d977ae55 Runtime: a draw's prepared data lives beside the per-command entries
Every command's detail::Prepared carried a draw's fields (a copy of the
GraphicsPipeline, eight attachment slots, depth, vertex and index views),
456 of its 1288 bytes, and the whole entry is refilled for every command on
every ExecuteCommandLists. They move to detail::PreparedDraw in
PreparedList::draws, which Prepared::draw indexes; the pool is kept between
executions like the PreparedList itself and reset() keeps its vectors'
storage. The entry is now 856 bytes.

The draw keeps a pointer to the context's GraphicsPipeline instead of a
copy (a vector and a std::function per draw): VulkanQueue::execute holds
the resource lock from prepare through emit, which add/remove_pipeline
need exclusively, and unordered_map elements don't move. emit builds the
colour attachments in a std::array of D3D12's 8 instead of a vector per
draw, and to_attachment takes the attachment const, so the const_cast goes.

replay_cpu_bench --self-test prepares an indexed draw with depth, then a
draw without either in the same storage, and checks the second keeps
neither (fails without reset(), checked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:32:07 -06:00
85ab929d69 Tests: replay_cpu_bench frame includes draws
The frame's passes now record 16 draws each (three of four indexed),
into the colour and depth targets with two vertex streams, and the
per-kind table times a draw and an indexed draw on their own. The scene
has one graphics pipeline and a geometry arena behind buffer_at, as
VulkanContext provides them.

i7-14700K: a draw costs 487-500 ns (record 170-180 with 4 allocations,
prepare 213, emit 104-107 with 1 allocation), and the frame (37,888
commands) 548 ns per command, 20.8 ms per ExecuteCommandLists for the
layer alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:32:07 -06:00
78ea5f8424 d3d12_compute_test: the CachedPSO blob's bytes no longer hide the test's bytes (C4456)
The CachedPSO block (9cc95bff) copies the cached blob into a
std::vector<std::uint8_t> named bytes, which hides the test's
constexpr UINT bytes = elements * 4 (line 285); MSVC reports C4456 at
line 395. The vector is now blob_bytes. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:30:34 -06:00
f0318f6218 Merge main and limit BVH target PR to its CMake dependency 2026-11-22 19:25:42 +01:00
9ccb1052e4 Validate named import thunk RVAs before narrowing
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 18:25:41 +00:00
663c4d9506 Cache host module names using growable heap buffers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 18:24:37 +00:00
55a073183e d3d12: SetName is readable as WKPDID_D3DDebugObjectNameW, with the right GUID
@pwu2775-dev found on #2533 that the tests' WKPDID_D3DDebugObjectNameW was
mistyped ({4cca5fd8-921f-42c8-8599-d2866a3e5f7e}, the layer's old constant)
instead of d3dcommon.h's {4cca5fd8-921f-42c8-8566-70caf2a9b741}. Measured with
the right key, the host runtime does what D3D12 documents: SetName is
SetPrivateData with that key and the name with its terminator, GetPrivateData
reads it back (an empty name is a 2-byte entry), and the narrow key is not
touched. SetName(nullptr) faults in the host and leaves the name as it was.

So the name goes back into the private data, now under the right GUID, and the
separate name_ / debug_name() are gone. SetName(nullptr) answers E_INVALIDARG
and changes nothing. d3d12_private_data_test: 667 steps compared, 0 mismatches
(RTX 3060, driver 610.88); d3d12_debug_markers_test checks the name again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:24:07 +01:00
2e5c9a9c43 Merge remote-tracking branch 'origin/main' into queue-wait-before-signal 2026-11-22 19:22:39 +01:00
fbc11e973d D3D12 queues: hold a batch that waits for a Signal not yet submitted, so layouts follow dependency order
A queue's ExecuteCommandLists is replayed against one LayoutTracker in call order, so a batch that waits (cross-queue) for a Signal submitted later was
recorded against layouts from before the work it waits for. Track, per fence, the highest Signal value submitted (CPU Signal and the creation value
count); a queue holds a batch, and what follows it, while a Wait names a higher value, and the thread that submits the satisfying Signal releases the
held work in dependency order on its own VkQueue. Reports a queue destroyed with held work and a fence released under a waiter; nothing blocks.

Adds d3d12_queue_handover_test (27 queue-type assignments x 6 submission orders, two producers, CPU Signal cases, never-signaled and released fences,
byte-exact against the host runtime) and updates docs section 4.4 and the M4 row. Two existing tests that used an unsignaled Wait as a GPU gate or
expected a synchronous submit failure under a pending Wait now declare the Signal first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:22:39 +01:00
26eb8f860f Build the TLS host alongside the FSR dispatch test 2026-11-22 19:18:30 +01:00
df1ae87efe runtime: buffer_at finds a buffer by binary search, not a scan of every resource
VulkanContext::buffer_at walked every registered resource, images included,
for each vertex-buffer slot, index buffer and WriteBufferImmediate of every
draw. It now asks a BufferVaIndex of the addressable buffers (no image, a
VkBuffer, a VA and bytes: what the scan accepted), kept in step with
resources_ by add_resource, add_sparse_buffer and remove_resource; a
re-registered ID drops its old range first.

Where placed buffers alias, the scan returned whichever matched first in
unordered_map order; the index returns the range that starts closest below
the VA. docs/d3d12_vulkan.md drops the "Lookups" known gap.
2026-11-22 19:17:52 +01:00
454ae0637c runtime: BufferVaIndex, an ordered VA -> buffer lookup
Buffers' VA ranges kept in a std::map by first VA: a lookup is a binary
search, walking down from the nearest start only while a range can still
reach the VA (bounded by the longest range), so aliasing placed buffers
that overlap still resolve, to the range that starts closest below the VA
(the larger ID on a tie).

buffer_va_index_test checks edges, overlapping and nested ranges,
re-registration and erase, then 200 random tables against a linear scan
with the same rule, and prints the lookup time against the scan over every
resource that buffer_at does today (--bench for 50k and 100k resources).
2026-11-22 19:17:52 +01:00
3a44e1926b Merge pull request #2736 from mrp1no 2026-11-22 13:17:27 -05:00
89d191af09 Merge pull request #2734 from admin 2026-11-22 13:17:26 -05:00
0963784063 PresentX planes: filter and blend in linear light, selectable SDR EOTF, Windows SDR white level, tone map
- Compose pass decodes every texel to linear (premultiplied) before filtering, converts the plane to the output's linear
  working space (Rec.2020 nits for HDR10, Rec.709 relative to SDR white for SDR), blends there and encodes once.
- SDR EOTF is piecewise sRGB by default (community-sourced Windows behaviour), gamma 2.2 by
  XboxPresentation::set_sdr_eotf or LEONIDA_SDR_EOTF=gamma22.
- SDR white: set_sdr_white_nits override, else DISPLAYCONFIG_SDR_WHITE_LEVEL of the window's output while HDR10 is
  active, else 203 nits (BT.2408).
- HDR10 on an SDR output: extended Reinhard on luminance (white point at the content peak, default 1000 nits) instead of a
  hard clip.
- HDR metadata stays unsent; docs section 4.5 documents the decisions and cites the sources.
- CPU reference model and xbox_present_test updated (linear model, EOTF option, 50% overlay, tone map, white level query).
- present_compose.inc rebuilt with glslc 2026.4 (byte-reproducible, spirv-val clean).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:17:24 +01:00
47449d3e29 Merge pull request #2729 from itsRevela
# Conflicts:
#	docs/design.md
2026-11-22 13:17:24 -05:00
5dbd34dacc Merge pull request #2728 from Størm 2026-11-22 13:17:23 -05:00
bd759946d2 Merge pull request #2719 from Vonsek 2026-11-22 13:17:18 -05:00
9f53808e02 Merge pull request #2713 from Capital 2026-11-22 13:17:16 -05:00
98d6888686 Merge pull request #2709 from totonii 2026-11-22 13:17:14 -05:00
3a40f5a539 Merge pull request #2702 from Sc4ros 2026-11-22 13:17:12 -05:00
c5649de1a9 Merge pull request #2698 from justr4mzi 2026-11-22 13:17:10 -05:00
06dc014792 Merge pull request #2693 from admin 2026-11-22 13:17:08 -05:00
2f82f70645 Merge pull request #2692 from FIocker 2026-11-22 13:17:08 -05:00
8511fbad1d Merge pull request #2689 from Capital 2026-11-22 13:17:06 -05:00
a44df460f3 Merge pull request #2662 from admin 2026-11-22 13:16:54 -05:00
7a560d0b7b Merge pull request #2661 from admin 2026-11-22 13:16:53 -05:00
4ac33f7e88 Merge pull request #2648 from skankhunt42 2026-11-22 13:16:47 -05:00
7c65aa6d0c Merge pull request #2635 from whattheflop 2026-11-22 13:16:41 -05:00
3dafb2335b Merge pull request #2630 from RaveN499 2026-11-22 13:16:40 -05:00
7fe2918ac8 Merge pull request #2607 from Vonsek 2026-11-22 13:16:31 -05:00
ecabe7533c Merge pull request #2599 from SPIN0ZAi 2026-11-22 13:16:27 -05:00
1c3360367f Merge pull request #2591 from 0xTehuti 2026-11-22 13:16:24 -05:00
fb3c9d343f Merge pull request #2574 from whoalin1 2026-11-22 13:16:17 -05:00
8599c9e64c Merge pull request #2567 from marquezini
# Conflicts:
#	docs/gameinput.md
2026-11-22 13:16:16 -05:00
f495169092 boot: the first-boot runbook and the two-trace summary
tools/boot_trace.py reads the `--trace` JSONL and the `[d3d12-trace]`
stderr lines and prints the units a first boot needs: modules, unimplemented
imports with their callers, DllMain/TLS results, exceptions with their
stack, the exit, and the D3D12 calls by outcome and first call per method.
It counts debug strings instead of printing them, so a real trace stays on
the player's machine; the tests use synthetic fixtures only.

docs/boot.md is the runbook around it: the Windows and Wine commands, the
LEONIDA_UNIMPLEMENTED and validation switches, the first-failure triage
order, and the Q1-Q22 table mapping each open question to the event to look
for. docs/README.md and runtime/README.md point at both.
2026-11-22 15:16:15 -03:00
23f61f5724 Merge pull request #2563 from Ewann 2026-11-22 13:16:12 -05:00
c1543e3449 Merge pull request #2552 from Leonida local test 2026-11-22 13:16:07 -05:00
13c5ee6209 Merge pull request #2550 from comp 2026-11-22 13:16:05 -05:00
0d6dddc8c7 Merge pull request #2533 from mrp1no 2026-11-22 13:15:58 -05:00
40055efb95 Merge pull request #2531 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 13:15:58 -05:00
a0d3f0b086 Merge pull request #2502 from Vonsek 2026-11-22 13:15:46 -05:00
c9fe0bd788 Merge pull request #2500 from Codex 2026-11-22 13:15:45 -05:00
00e53365b7 Merge pull request #2483 from Shadman PC 2026-11-22 13:15:38 -05:00
4fa6c61ff9 Merge pull request #2480 from whoalin1 2026-11-22 13:15:37 -05:00
da3861dd86 Merge pull request #2462 from mrp1no 2026-11-22 13:15:29 -05:00