Repository navigation
vulkan: don't keep a buffer-chain node whose buffer was not mapped - #19747
Merged
LibretroAdmin merged 2 commits intoOct 8, 2026
Merged
Conversation
vulkan_create_buffer returns a buffer with mapped == NULL when creation, allocation or vkMapMemory fails. The buffer chain kept such a node, and suballoc then handed out NULL plus an offset as the range's data. Drop the node instead; vulkan_buffer_chain_alloc already returns false when no node can be made. Tests: none run; no harness links vulkan.c. RetroArch builds with the change and the file compiles without warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HDR pass writes its uniforms through the buffer's mapping, which is NULL when vkMapMemory failed at init; the pass is skipped then, as it is when no descriptor set can be had. check-vulkan-mapfail runs the Vulkan lanes through the fake memory layer with the first map of a 64 KiB buffer refused on each device - the size of a buffer-chain block - and every lane must still pass. A chain that kept the unmapped node wrote through NULL; the Vulkan validation workflow runs it after the XRGB8888 pass.
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.
vulkan_create_bufferreturns a buffer withmapped == NULLwhen creation, memory allocation orvkMapMemoryfails.vulkan_buffer_chain_alloc_nodekept such a node, andvulkan_buffer_chain_suballocthen handed outmapped + offsetas the range's data, which callersmemcpyinto.The node allocator now destroys the buffer, frees the node and returns NULL.
vulkan_buffer_chain_allocalready returns false in that case, and its callers check it.Testing (Linux x86_64): full build; the file compiles without warnings. Not run: this path is reached only when an allocation fails, and nothing here can force that.
Found by a static-analysis pass over the tree.
🤖 Generated with Claude Code