Claimed in the coordination issue as: https://github.com/ItsNotRexed/Leonida/issues/1380#issuecomment-7079042672
What and why
CreateGraphicsPipelineState previously logged index-buffer strip cuts (primitive restart) are not modelled and left primitive restart disabled on all graphics pipelines.
This change:
- Loads core Vulkan 1.3
vkCmdSetPrimitiveRestartEnableinruntime/src/vulkan_backend.hand wires it intoReplayCallbacks. - Adds
VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLEto graphics pipelines inruntime/shims/d3d12_vulkan_device.cpp(beforeVK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDEso pipelines with no vertex bindings still omit only the stride state) and recordsIBStripCutValueonleonida::GraphicsPipeline. - In
runtime/src/vulkan_replay.h, callsvkCmdSetPrimitiveRestartEnableon every draw, enabling primitive restart only when the draw is indexed, the dynamic topology is a strip (LINE_STRIP,TRIANGLE_STRIP, or their adjacency forms), and the bound index format matches the PSO'sIBStripCutValue(0xFFFFwithVK_INDEX_TYPE_UINT16,0xFFFFFFFFwithVK_INDEX_TYPE_UINT32). - Adds a synthetic GPU draw test in
runtime/test/d3d12_draw_test.cppdrawing two disjoint quads (top-left and bottom-right) in a singleTRIANGLESTRIPDrawIndexedInstancedcall with0xFFFF(UINT16),0xFFFFFFFF(UINT32), and a no-cut negative control (DISABLED).
AI-assisted (Antigravity / Gemini, operated by Vonsek).
Tested
Synthetic scene only (no game files or game shaders were run). Built from commit 432d9ab1 (based on upstream/main 99f99890) on Windows 11 with VS 2022 Build Tools (MSVC 19.44.35230.0), Ninja, -DLEONIDA_VULKAN_HEADERS_FETCH=ON, and Khronos glslang 16.6.0. VK_LOADER_LAYERS_DISABLE=~implicit~ was set; VK_LAYER_KHRONOS_validation is not installed locally on this host (CI runs validation).
Before the fix (99f99890): CreateGraphicsPipelineState logged index-buffer strip cuts (primitive restart) are not modelled and left primitive restart disabled.
Commands and measured outcomes on 432d9ab1:
- NVIDIA GeForce RTX 5080 (
0x10de:0x2c02), driver616.92, Vulkan1.4.351(LEONIDA_VK_DEVICE=5080):ctest --test-dir build-strip-cut -R "^(d3d12_draw|d3d12_vulkan_device)$" --output-on-failure -V-> 2/2 passed.strip cut (0xFFFF & 0xFFFFFFFF): 4096/4096 pixels matched each (no-cut negative control painted 256 bridge pixels in bottom-left)
- AMD Radeon(TM) Graphics (
0x1002:0x13c0), driver26.10.1, Vulkan1.4.315(LEONIDA_VK_DEVICE=Radeon):ctest --test-dir build-strip-cut -R "^d3d12_draw$" --output-on-failure -V-> 1/1 passed.strip cut (0xFFFF & 0xFFFFFFFF): 4096/4096 pixels matched each (no-cut negative control painted 256 bridge pixels in bottom-left)
- Negative control: drawing the same two quads as a continuous triangle strip without a strip cut painted the predicted 256 bridge pixels in the bottom-left quadrant red (matching the analytical triangle
((-1,0), (0,0), (1,-1))), whereas both0xFFFFand0xFFFFFFFFstrip-cut draws kept all 1,024 bottom-left pixels pure blue(0, 0, 255, 255)on both GPUs.
Checklist
- No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
- A new translator rule is in the contract table of
docs/design.md, with how it was confirmed. (N/A — runtime graphics pipeline/replay change only.)
Activity
3Closing in favor of #572 (D3D-57) by @ezwinxdlmao, which already owns IBStripCutValue primitive restart. Thanks @Flyander for catching the overlap! (AI-assisted, operated by Vonsek.)
Coordination check: this covers the same D3D-57 / IBStripCutValue primitive-restart behavior as the still-open #572. #572 is stale against the post-#291 main and carries the larger restart test matrix; this PR is a fresh targeted branch on current main. Please mark one explicitly as the successor and port any unique tests before both stay active, so maintainers don't review or merge the same runtime change twice.