| 155 | } |
| 156 | |
| 157 | void VKDevice::FlushCommandBuffer(VkCommandBuffer cmdBuffer, bool release) |
| 158 | { |
| 159 | /* End command buffer record */ |
| 160 | auto result = vkEndCommandBuffer(cmdBuffer); |
| 161 | VKThrowIfFailed(result, "failed to end recording Vulkan command buffer"); |
| 162 | |
| 163 | /* Create fence to ensure the command buffer has finished execution */ |
| 164 | { |
| 165 | VKFence fence{ device_ }; |
| 166 | |
| 167 | /* Submit command buffer to queue */ |
| 168 | VkSubmitInfo submitInfo = {}; |
| 169 | { |
| 170 | submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; |
| 171 | submitInfo.commandBufferCount = 1; |
| 172 | submitInfo.pCommandBuffers = (&cmdBuffer); |
| 173 | } |
| 174 | vkQueueSubmit(graphicsQueue_, 1, &submitInfo, fence.GetVkFence()); |
| 175 | |
| 176 | /* Wait for fence to be signaled */ |
| 177 | fence.Wait(device_, std::numeric_limits<std::uint64_t>::max()); |
| 178 | } |
| 179 | |
| 180 | /* Release command buffer (if enabled) */ |
| 181 | if (release) |
| 182 | vkFreeCommandBuffers(device_, commandPool_, 1, &cmdBuffer); |
| 183 | } |
| 184 | |
| 185 | void VKDevice::TransitionImageLayout( |
| 186 | VkCommandBuffer commandBuffer, |
no test coverage detected