Handle null handles in vkFreeCommandBuffers

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
Jason Macnak
2024-08-09 09:33:12 -07:00
committed by Marge Bot
parent e64534bd64
commit 3683fbcdee

View File

@@ -171,20 +171,26 @@ void gfxstream_vk_FreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
VK_FROM_HANDLE(gfxstream_vk_command_pool, gfxstream_commandPool, commandPool);
{
// Set up internal commandBuffer array for gfxstream-internal call
std::vector<VkCommandBuffer> internal_objects(commandBufferCount);
std::vector<VkCommandBuffer> internal_objects;
internal_objects.reserve(commandBufferCount);
for (uint32_t i = 0; i < commandBufferCount; i++) {
VK_FROM_HANDLE(gfxstream_vk_command_buffer, gfxstream_commandBuffer,
pCommandBuffers[i]);
internal_objects[i] = gfxstream_commandBuffer->internal_object;
if (gfxstream_commandBuffer) {
internal_objects.push_back(gfxstream_commandBuffer->internal_object);
}
}
auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
vkEnc->vkFreeCommandBuffers(gfxstream_device->internal_object,
gfxstream_commandPool->internal_object, commandBufferCount,
gfxstream_commandPool->internal_object,
internal_objects.size(),
internal_objects.data(), true /* do lock */);
}
for (uint32_t i = 0; i < commandBufferCount; i++) {
VK_FROM_HANDLE(gfxstream_vk_command_buffer, gfxstream_commandBuffer, pCommandBuffers[i]);
vk_command_buffer_destroyOp(&gfxstream_commandBuffer->vk);
if (gfxstream_commandBuffer) {
vk_command_buffer_destroyOp(&gfxstream_commandBuffer->vk);
}
}
}