Commit dcb95dec authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

VulkanCommandBuffer: fix a problem for vkQueueSubmit.

VkSubmitInfo::pWaitDstStageMask must be must be a valid pointer
to an array of waitSemaphoreCount valid combinations of
VkPipelineStageFlagBits values.

Bug: None
Change-Id: I23fe8210f724cbb11c48e6dcab7e6452fe0cab3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630540Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663773}
parent d8ec3abe
...@@ -95,12 +95,14 @@ bool VulkanCommandBuffer::Initialize() { ...@@ -95,12 +95,14 @@ bool VulkanCommandBuffer::Initialize() {
VkResult result = VK_SUCCESS; VkResult result = VK_SUCCESS;
VkDevice device = device_queue_->GetVulkanDevice(); VkDevice device = device_queue_->GetVulkanDevice();
VkCommandBufferAllocateInfo command_buffer_info = {}; VkCommandBufferAllocateInfo command_buffer_info = {
command_buffer_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
command_buffer_info.commandPool = command_pool_->handle(); .pNext = nullptr,
command_buffer_info.level = primary_ ? VK_COMMAND_BUFFER_LEVEL_PRIMARY .commandPool = command_pool_->handle(),
: VK_COMMAND_BUFFER_LEVEL_SECONDARY; .level = primary_ ? VK_COMMAND_BUFFER_LEVEL_PRIMARY
command_buffer_info.commandBufferCount = 1; : VK_COMMAND_BUFFER_LEVEL_SECONDARY,
.commandBufferCount = 1,
};
result = result =
vkAllocateCommandBuffers(device, &command_buffer_info, &command_buffer_); vkAllocateCommandBuffers(device, &command_buffer_info, &command_buffer_);
...@@ -130,19 +132,22 @@ bool VulkanCommandBuffer::Submit(uint32_t num_wait_semaphores, ...@@ -130,19 +132,22 @@ bool VulkanCommandBuffer::Submit(uint32_t num_wait_semaphores,
VkSemaphore* wait_semaphores, VkSemaphore* wait_semaphores,
uint32_t num_signal_semaphores, uint32_t num_signal_semaphores,
VkSemaphore* signal_semaphores) { VkSemaphore* signal_semaphores) {
VkPipelineStageFlags wait_dst_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
DCHECK(primary_); DCHECK(primary_);
VkSubmitInfo submit_info = {}; std::vector<VkPipelineStageFlags> wait_dst_stage_mask(
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; num_wait_semaphores, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &command_buffer_; VkSubmitInfo submit_info = {
submit_info.waitSemaphoreCount = num_wait_semaphores; .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
submit_info.pWaitSemaphores = wait_semaphores; .pNext = nullptr,
submit_info.pWaitDstStageMask = &wait_dst_stage_mask; .waitSemaphoreCount = num_wait_semaphores,
submit_info.signalSemaphoreCount = num_signal_semaphores; .pWaitSemaphores = wait_semaphores,
submit_info.pSignalSemaphores = signal_semaphores; .pWaitDstStageMask = wait_dst_stage_mask.data(),
.commandBufferCount = 1,
.pCommandBuffers = &command_buffer_,
.signalSemaphoreCount = num_signal_semaphores,
.pSignalSemaphores = signal_semaphores,
};
VkResult result = VK_SUCCESS; VkResult result = VK_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment