Commit Graph

9 Commits

Author SHA1 Message Date
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
9df4eda200 Runtime: VulkanQueue keeps its PreparedList storage between executions
execute built a new std::vector<PreparedList> on every call, so every
command's detail::Prepared entry (1288 bytes on main now) was made in
fresh memory and freed again: replay_cpu_bench measures that at 274-292
ns per command on an i7-14700K, against 85 ns refilled in kept storage,
over half of the layer's whole CPU cost per command. The queue now keeps
the vector as a member (per queue, like its command buffers: one execute
at a time on a queue, as acquire() and submit() already assume) and
resizes it to the list count; prepare refills each list's entries in
place, where the per-entry vectors also keep their capacity.

replay_cpu_bench mirrors the change and reports both floors (entries in
kept storage and made fresh). Its frame goes from 425 to 194 ns per
command (a 21,504-command frame from 9.1 ms to 4.2 ms).

d3d12_vulkan_device_test executes {B, A}, then {B} alone, and checks
that only B ran the second time: with storage that only grows, a stale A
is replayed after B and the test fails (checked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:19:29 -06:00
3b7cbf46c7 Resolve indirect arguments relative to Vulkan backing buffers 2026-11-22 11:22:14 +01:00
29345889be Runtime: capture full 64-bit predication values on the GPU 2026-11-22 04:34:35 -04:00
21bf8c3d79 Merge binary occlusion and share queue resolve resources 2026-11-22 04:05:44 -03:00
0029a87b12 Plan query replay in the CPU benchmark 2026-11-22 03:25:37 -03:00
319c86039f Mock binary occlusion resolves in the CPU replay benchmark 2026-11-22 03:25:13 -03:00
9528e239e8 Tests: replay_cpu_bench, the layer's CPU cost per command
A benchmark of the D3D12 -> Vulkan replay's own CPU time: CommandList
recording, prepare and emit, with no-op Vulkan entry points that count
their calls and fake resource bindings, so no GPU, driver or game files
are involved. Bindings and image views are looked up the way
VulkanContext does (unordered_map, std::map view cache), and each
execution makes a new PreparedList, as VulkanQueue::execute does.

It reports, for every command kind on its own and for a frame mix
(barriers, whole-view and rectangle clears, buffer and texture copies,
a UAV clear, queries, predication), the median ns per command of each
phase, heap allocations per command and Vulkan calls per command, plus
the cost of just making and freeing the PreparedList entries.
--self-test (in ctest) checks that every kind and the frame record and
replay, and that the counts are the same on a second run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:07:56 -06:00