Repository navigation
Conversation
- vulkan_present.h: VulkanPresenter blits a back buffer (an ordinary texture in D3D12's PRESENT state, layout tracked like any other) to an acquired swapchain image and presents it on the same VkQueue, after the application's work. Two frames in flight, a present semaphore per image, FIFO for vsync else MAILBOX/IMMEDIATE, swapchain recreated on resize or out-of-date/suboptimal, minimised windows skip presents. - rt::d3d12::create_window_presenter / WindowPresenter: Win32 surface for a Vulkan device created with presentation; holds the device. This is the back end a DXGI shim or PresentX would call; the game's own front end is still open (docs question 6), so neither is invented here. - Standalone device enables VK_KHR_surface/win32_surface and VK_KHR_swapchain when present; the test helper can too. Test: d3d12_present_test opens a window and presents 60 frames through the Xbox-ABI proxy (reset, PRESENT->RENDER_TARGET, clear, ->PRESENT, execute, present, fence), resizes the window (swapchain recreated, scaled blit), switches to unsynchronised presents, and reads the screen with GDI: 51,153,229 for a 51,153,230 clear. Clean under the Khronos validation layer, as are the other GPU tests; 6/6 ctest.
The debug messenger in test/vk_test_device.h counted every error-severity message, so a broken third-party implicit layer (ReShade's, reported on an RTX 5090) failed every GPU test. Only VALIDATION-type errors are counted now; general loader and layer messages are still printed, marked "not counted". A real validation error still fails the test (checked by replaying part B of vk_command_replay_test without the layout tracker). runtime/README.md says so and mentions VK_LOADER_LAYERS_DISABLE.
First pieces of D3D-3 (compute path), no pipelines wired up yet: - shader_library.h: FSSM extraction from the DXBC container (DXIL, XDAT 0x0D, XBCH, zlib), SHA-256, a minimal JSON reader and the spirv/index.json lookup by fssm_sha256. Self-contained inflate, no dependencies. - IR Dispatch with user data captured at record time; replay binds the pipeline, pushes the 144-byte block (s0..s31, heap base, code base) and dispatches. Arena buffers get a buffer_offset that copies honour. - Root signatures use main's model (runtime/src/root_signature.h); the docs say so. Tests: shader_library_test (FIPS 180-4 vectors; stored, fixed and dynamic deflate blocks; corrupt and truncated streams; FSSM from a synthetic container) joins ctest; command_list_test covers dispatch recording.
… compute PSOs, Dispatch) - GPU address arena (docs 3.3), when the device has bufferDeviceAddress: one host-visible, device-addressable buffer (LEONIDA_ARENA_MB, default 256, max 4095 so VAs fit 32-bit table pointers). Default-heap buffers are 64 KiB-aligned ranges with VA = offset, zeroed through the mapping; shader-visible descriptor heaps live there (CPU handle = mapping, GPU handle = VA); upload/readback buffers get VA = device address - heap base; GetGPUVirtualAddress returns these. - CreateRootSignature on main's model (rt::rootsig): parse_rts0, then pack() for each parameter's place in the 32 user-data dwords; what pack() refuses is refused with its reason. CreateComputePipelineState (PC slot 11, Xbox slot 62 via the proxy) finds the shader by the SHA-256 of its FSSM program in the translator's index (VulkanDeviceInfo::shader_dir or LEONIDA_SHADERS); its FSSM blob is copied into the arena as the code base. Shaders that declare set-0 bindings are refused with a log until the bindless set exists (M2). - Command list: root signatures (arguments cleared on change), pipeline state, constant / root view / descriptor-table setters for compute and graphics, SetDescriptorHeaps, Dispatch recording the user data as it is, ClearState (which also resets ItsNotRexed#164's stencil references); misuse makes Close return E_INVALIDARG. - Test helper and standalone device enable bufferDeviceAddress. Test: d3d12_compute_test (through the proxy) creates the root signature from the PC serializer's blob and the PSO through slot 62 in the measured (desc, 0, 0, riid, out) shape (28cf235) from a container shaped like the game's, sets root constants, a root UAV and a table whose application-written entry points at an upload buffer, runs two dispatches that each keep their own arguments, and reads the results back: 64/64 twice. Its shader is GLSL written to the translator's push-constant and address contract, compiled with glslangValidator. Clean under the Khronos validation layer, as are the other GPU tests; 13/13 ctest.
- CreateGraphicsPipelineState (PC slot 10): VS and PS found by the SHA-256 of their FSSM programs in the translator's index. Input-layout elements are matched to the VS input signature by semantic name and index; location = the element's register (the translator's vertex-fetch rule); a layout that leaves an input unfed is refused, as D3D12 does. Rasterizer, blend and depth-stencil state map one to one; viewport, scissor, topology, vertex strides, stencil references and blend factor are dynamic; dynamic rendering takes the RTV/DSV formats. Hull/domain/geometry, stream output, MSAA, set-0 bindings and two code-base stages (question 14) are refused with a log. - Command list: IASetPrimitiveTopology / VertexBuffers / IndexBuffer, RSSetViewports / ScissorRects (first of each), OMSetRenderTargets (views read at the call, single-range handles too), OMSetBlendFactor, OMSetStencilRef and CommandList8's front/back references (now applied), DrawInstanced / DrawIndexedInstanced recording a copy of that state. CreateCommandList's initial pipeline state is applied. Reset and ClearState share one state reset. - Replay: vertex/index views resolve to buffers by VA (arena or upload), attachments move to attachment layouts through the tracker (first use zero-fills), the draw runs in a dynamic-rendering scope with a flipped viewport (translated VS write D3D clip coordinates), stencil references per face, then vkCmdDraw / vkCmdDrawIndexed. Render-target views take the pipeline's formats (the view cache keys on format). - shader_library.h reads the index's input_signature and PS outputs. Test: d3d12_draw_test (through the proxy) builds a VS+PS PSO whose input layout order differs from the VS registers, uploads a vertex buffer into the arena, reads indices from an upload heap, and draws two indexed quads with different root constants and root CBVs plus a back-facing triangle: all 4096 read-back pixels match (which also checks the viewport flip and winding). Shaders are GLSL written to the translator's contract. d3d12_com_test now uses SetMarker as its unimplemented-method example, since DrawInstanced is implemented. 13/13 ctest; all six GPU tests clean under the Khronos validation layer.
…n (arena without Resizable BAR) Without Resizable BAR the only DEVICE_LOCAL | HOST_VISIBLE memory type sits in a heap of 256 MiB or less (214 MiB on an RTX 3090, driver 616.56). The 256 MiB default arena preferred that type, so vkAllocateMemory was asked for more than the heap holds (VUID-vkAllocateMemory-pAllocateInfo-01713). The NVIDIA driver still returned VK_SUCCESS, so the fallback to plain host-visible memory never ran, and d3d12_compute_test and d3d12_draw_test failed under validation. Reported by CharlyRien. memory_type_order (vulkan_backend.h) now leaves out every type whose heap is smaller than the allocation, so the preference falls through to system memory there. DeviceState::allocate uses it for every allocation. d3d12_state_map_test checks the order on that card's heap layout and with Resizable BAR on.
mrb-eel
force-pushed
the
runtime/indirect-compute-dispatch
branch
from
November 21, 2026 22:57
3cf24a9 to
93e4135
Compare
This was referenced Nov 21, 2026
This was referenced Nov 21, 2026
2 tasks done
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update: Main now has the ExecuteIndirect implementation from #743. The separate correction for suballocated argument and count buffers is tracked in #1339. This earlier draft is superseded.
What and why
D3D-17, fixed-count compute dispatch. Depends on: #291. Claim.
Accept a dispatch-only command signature, capture the compute PSO and root data at ExecuteIndirect, and emit one vkCmdDispatchIndirect per record. Check alignment and resource bounds before recording the prepared Vulkan list. The test copies padded records into a resource inside the shared GPU arena, then dispatches through the D3D12/Xbox-ABI path. Graphics and mesh dispatch, GPU count buffers, and signatures that change bindings remain follow-up work.
This draft is based on #291 at f921105. The focused implementation is 93e4135.
Tested
AI-assisted implementation and testing.