Minor refactor for vulkan renderer#176
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors Vulkan memory type retrieval by moving FindMemoryType from individual texture classes to TizenRendererVulkan, adds a null check for pixel_buffer->buffer, and introduces error handling for vkMapMemory. Review feedback suggests refactoring CopyBufferToImage to propagate mapping failures and checking for null command buffers to prevent crashes. Additionally, it is recommended to ensure subclasses of ExternalTextureSurfaceVulkanBuffer can still access FindMemoryType, and to use pointers instead of references for output parameters in FindMemoryType to align with the Google C++ Style Guide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- Check return value of tbm_surface_get_info() in CreateImage() - Return false early if the call fails to prevent undefined behavior - Follows the same error handling pattern as external_texture_surface_egl.cc Co-Authored-By: Cline SR
Change uint32_t initialization from -1 to 0 to avoid implicit signed-to-unsigned conversion, improving code clarity. Co-Authored-By: Cline SR
- Change CopyBufferToImage return type from void to bool - Add error propagation for vkMapMemory failure - Add null check for BeginSingleTimeCommands return value - Update caller in PopulateVulkanTexture to check return value Fixes two critical issues identified by code review bot: 1. Lack of error propagation when vkMapMemory fails 2. Unchecked command buffer that could be VK_NULL_HANDLE Co-Authored-By: Cline SR
…inter Follow Google C++ Style Guide: output parameters should be passed as pointers rather than references to make it clear at the call site that the argument may be modified. Changed: - tizen_renderer_vulkan.h: Declaration updated to use uint32_t* instead of uint32_t& - tizen_renderer_vulkan.cc: Implementation updated with pointer dereference - external_texture_pixel_vulkan.cc: Call site updated to pass address Co-Authored-By: Cline SR
There was a problem hiding this comment.
Code Review
This pull request refactors Vulkan external texture handling by centralizing memory type lookup in TizenRendererVulkan, improving error handling, and adding resource cleanup on allocation failures. The review feedback recommends closing the exported file descriptor bo_fd if GetFdMemoryTypeIndex fails to prevent a leak, validating that pixel_buffer dimensions are positive before memory allocation, and adding a null check for the index_out pointer in FindMemoryType to avoid potential null pointer dereferences.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…ence - Add null pointer check for index_out parameter at the beginning of FindMemoryType function - Return false early if index_out is null to prevent potential crashes Co-Authored-By: Cline SR
Add close(bo_fd) call when GetFdMemoryTypeIndex() fails to prevent file descriptor leak in AllocateAndBindMemory(). Co-Authored-By: Cline SR
- Validate width and height are non-zero before creating Vulkan image/buffer - Prevents invalid memory allocation and Vulkan errors from zero-dimension textures Co-Authored-By: Cline SR
| FT_LOG(Error) << "Fail to bind image memory"; | ||
| return false; |
There was a problem hiding this comment.
In this case, is it unnecessary to call close(bo_fd);? It seems like it is missing.
Main changes: