render/vulkan: use initializers for VkSubmitInfo

Simon Ser 2 years ago
parent 666c45bb29
commit a37a22e344

@ -946,8 +946,9 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
free(acquire_barriers); free(acquire_barriers);
free(release_barriers); free(release_barriers);
unsigned submit_count = 0u;
VkSubmitInfo submit_infos[2] = {0}; VkSubmitInfo submit_infos[2] = {0};
VkSubmitInfo *stage_sub = &submit_infos[0];
VkSubmitInfo *render_sub = &submit_infos[1];
// No semaphores needed here. // No semaphores needed here.
// We don't need a semaphore from the stage/transfer submission // We don't need a semaphore from the stage/transfer submission
@ -963,15 +964,14 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
.signalSemaphoreValueCount = 1, .signalSemaphoreValueCount = 1,
.pSignalSemaphoreValues = &stage_timeline_point, .pSignalSemaphoreValues = &stage_timeline_point,
}; };
*stage_sub = (VkSubmitInfo){
VkSubmitInfo *stage_sub = &submit_infos[submit_count]; .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
stage_sub->sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; .pNext = &stage_timeline_submit_info,
stage_sub->pNext = &stage_timeline_submit_info; .commandBufferCount = 1,
stage_sub->commandBufferCount = 1u; .pCommandBuffers = &stage_cb->vk,
stage_sub->pCommandBuffers = &stage_cb->vk; .signalSemaphoreCount = 1,
stage_sub->signalSemaphoreCount = 1; .pSignalSemaphores = &renderer->timeline_semaphore,
stage_sub->pSignalSemaphores = &renderer->timeline_semaphore; };
++submit_count;
uint64_t stage_wait_timeline_point; uint64_t stage_wait_timeline_point;
VkPipelineStageFlags stage_wait_stage; VkPipelineStageFlags stage_wait_stage;
@ -1022,18 +1022,17 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
.signalSemaphoreValueCount = render_signal_len, .signalSemaphoreValueCount = render_signal_len,
.pSignalSemaphoreValues = render_signal_timeline_points, .pSignalSemaphoreValues = render_signal_timeline_points,
}; };
*render_sub = (VkSubmitInfo){
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.pNext = &render_timeline_submit_info,
.pCommandBuffers = &render_cb->vk,
.commandBufferCount = 1,
.signalSemaphoreCount = render_signal_len,
.pSignalSemaphores = render_signal,
};
VkSubmitInfo *render_sub = &submit_infos[submit_count]; uint32_t submit_count = sizeof(submit_infos) / sizeof(submit_infos[0]);
render_sub->sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; VkResult res = vkQueueSubmit(renderer->dev->queue, submit_count, submit_infos, NULL);
render_sub->pNext = &render_timeline_submit_info;
render_sub->pCommandBuffers = &render_cb->vk;
render_sub->commandBufferCount = 1u;
render_sub->signalSemaphoreCount = render_signal_len;
render_sub->pSignalSemaphores = render_signal;
++submit_count;
VkResult res = vkQueueSubmit(renderer->dev->queue, submit_count,
submit_infos, NULL);
if (res == VK_ERROR_DEVICE_LOST) { if (res == VK_ERROR_DEVICE_LOST) {
wlr_log(WLR_ERROR, "vkQueueSubmit failed with VK_ERROR_DEVICE_LOST"); wlr_log(WLR_ERROR, "vkQueueSubmit failed with VK_ERROR_DEVICE_LOST");
wl_signal_emit_mutable(&wlr_renderer->events.lost, NULL); wl_signal_emit_mutable(&wlr_renderer->events.lost, NULL);

Loading…
Cancel
Save