Repository navigation
Conversation
…nup, and target guards
|
Tested I built and ran I also repeated a cleanup case 128 times with the PR's Vulkan mock. Each cycle creates a 64×64 target and forces view creation to fail during a resize to 32×32. After each failure, the image, memory allocation, and view creation counts match their corresponding release counts. The next cycle can create a target again. The new test built against merge base AI-assisted. |
|
NVIDIA datapoint for Windows 11 x64, GeForce RTX 5090 (driver 617.42), Vulkan SDK 1.4.363.0, MSVC 14.44.35207, Ninja / RelWithDebInfo.
AI-assisted (Devin); no game files. |
|
Reviewed at merge with current main 3faac55: the auto-merge is clean textually, but note main gained PR #3551 (3ff1566, verified on main) inside runtime/test/vk_presenter_sync_test.cpp after your base d0835dd — so the merged test file is new in combination and has never been compiled anywhere, and this branch reports no CI checks at all. Please run the windows job on the merge commit before landing. The header changes themselves review well: handles validated after every vkCreate, partial-init cleanup lambdas, a state guard before target creation, memoryTypeCount clamped to VK_MAX_MEMORY_TYPES. No game data; nothing else on main touched these files. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only review). |
|
Tested 9e58c0f on NVIDIA GeForce RTX 4080 (driver 617.42), Windows 11, clang-cl cross-build: no regression, but the present test cannot run here.
xbox_present_test and the PR's red control were not run, and the validation layer was not enabled, so the PR's validation claims are not reproduced here. AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed head 9e58c0f9f2f749df51feefc426efbadbf8e7eb28. Windows 11 26200, MSVC 19.44.35207, Ninja, RelWithDebInfo, Vulkan 1.4.363, RTX 5070 Ti.
vk_presenter_sync 1/1: PresentComposer hardening ok; the held presents (229,26,51), capture WAW 4/4, concurrent present/execute, and device-idle teardown checks still pass. Red: reverting runtime/src/vulkan_present_compose.h only exits 1 at line 778: !c.ready() — a MockVk with missing function pointers was accepted as ready.
Verdict: ready to merge. Partial initialisation unwinds, a 0x0 extent is refused instead of creating a 0x0 swapchain/blit, and a composer that is not ready returns VK_ERROR_FORMAT_NOT_SUPPORTED from vulkan_present.h instead of dispatching null handles.
402 of the 491 lines are the new MockVk test; the header change is contained. Related: #4852 (presenter sync setup errors) and merged #5928 overlap in coverage, not code. First-frame: a failed first present now degrades to "compose unsupported" rather than a null-handle dispatch.
Claim: #4683 (comment)
Summary
Hardens
PresentComposerinruntime/src/vulkan_present_compose.hand adds deterministicMockVkregression coverage inruntime/test/vk_presenter_sync_test.cpp(Section 4):ready()now checksdevice != VK_NULL_HANDLEand all 11 previously unchecked device function pointers (vkDestroyShaderModule,vkDestroyDescriptorSetLayout,vkDestroyDescriptorPool,vkDestroyPipelineLayout,vkDestroyPipeline,vkGetImageMemoryRequirements,vkBindImageMemory,vkDestroyImageView,vkDestroyImage,vkFreeMemory,vkCmdPipelineBarrier);~PresentComposer()andrelease_target()guard destroy calls on non-null function pointers.ready(): Pipeline/descriptor objects are created into locals and destroyed immediately if any step fails, requiringvkCreateComputePipelines(...) == VK_SUCCESS && pipeline != VK_NULL_HANDLEand never passing failed/garbage output handles tovkDestroyPipeline.ensure_target()validation & clean failure recovery: Rejects non-ready composers and zero extents (width == 0 || height == 0), clampsmemory_.memoryTypeCounttoVK_MAX_MEMORY_TYPES, creates image/memory/view into locals, and destroys only created objects on failure without invoking cleanup on garbage output handles.record()guards & overflow-safe dispatch: Guards non-ready state, null command buffer, or missing target/zero extent, and dispatches((width - 1u) / 8u + 1u, (height - 1u) / 8u + 1u, 1).Red Control (pre-fix on
d0835dd9)Running Section 4 against unmodified
runtime/src/vulkan_present_compose.hfailed immediately as expected:vk_presenter_sync_test.exe-> exit1atline 605: !c.ready()(missingvkGetImageMemoryRequirementsallowedready()to report success).Verification (post-fix at
9e58c0f9on Windows 11 x64, AMD Radeon RX 6900 XT, Vulkan SDK1.4.363.1)cmd /c "call vcvars64.bat >nul && cmake --build runtime/build --config RelWithDebInfo --target vk_presenter_sync_test d3d12_present_test xbox_present_test gta6rt"):[22/22]exit0, zero warnings in touched files.runtime\build\vk_presenter_sync_test.exe(standard): exit0(vk_presenter_sync_test: ok, includingpresenter sync: PresentComposer hardening ok).LEONIDA_VK_VALIDATION=1 runtime\build\vk_presenter_sync_test.exe: exit0(device: AMD Radeon RX 6900 XT (validation on), 0 validation errors).ctest --test-dir runtime/build --output-on-failure -R "^(vk_presenter_sync|d3d12_present|xbox_present)$":3.06 sec).LEONIDA_VK_VALIDATION=1: 3/3 passed (3.08 sec).git merge-tree --write-tree upstream/main HEADexit0;python -I tests/test_ctest_registration.py(4 tests OK);python -I scripts/check_no_game_data.pyexit0;git diff --checkexit0;CRLF=0on both touched files.AI-assisted (Gemini, Antigravity); no copyrighted game files or dumps used.