aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-12-03 09:44:03 +0100
committerSimon Ser <contact@emersion.fr>2022-12-03 09:53:32 +0100
commita37a22e3443d1a250ff1c87221c14bcb780a4d7b (patch)
tree1f0dee18da431fa3e96bb628aa117fb730129f90
parent666c45bb29d9c9e9dae36769ccb0840beff7e5da (diff)
render/vulkan: use initializers for VkSubmitInfo
-rw-r--r--render/vulkan/renderer.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index 927a3cbf..c780770c 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -946,8 +946,9 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
free(acquire_barriers);
free(release_barriers);
- unsigned submit_count = 0u;
VkSubmitInfo submit_infos[2] = {0};
+ VkSubmitInfo *stage_sub = &submit_infos[0];
+ VkSubmitInfo *render_sub = &submit_infos[1];
// No semaphores needed here.
// 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,
.pSignalSemaphoreValues = &stage_timeline_point,
};
-
- VkSubmitInfo *stage_sub = &submit_infos[submit_count];
- stage_sub->sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- stage_sub->pNext = &stage_timeline_submit_info;
- stage_sub->commandBufferCount = 1u;
- stage_sub->pCommandBuffers = &stage_cb->vk;
- stage_sub->signalSemaphoreCount = 1;
- stage_sub->pSignalSemaphores = &renderer->timeline_semaphore;
- ++submit_count;
+ *stage_sub = (VkSubmitInfo){
+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
+ .pNext = &stage_timeline_submit_info,
+ .commandBufferCount = 1,
+ .pCommandBuffers = &stage_cb->vk,
+ .signalSemaphoreCount = 1,
+ .pSignalSemaphores = &renderer->timeline_semaphore,
+ };
uint64_t stage_wait_timeline_point;
VkPipelineStageFlags stage_wait_stage;
@@ -1022,18 +1022,17 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
.signalSemaphoreValueCount = render_signal_len,
.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];
- render_sub->sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- 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);
+ uint32_t submit_count = sizeof(submit_infos) / sizeof(submit_infos[0]);
+ VkResult res = vkQueueSubmit(renderer->dev->queue, submit_count, submit_infos, NULL);
if (res == VK_ERROR_DEVICE_LOST) {
wlr_log(WLR_ERROR, "vkQueueSubmit failed with VK_ERROR_DEVICE_LOST");
wl_signal_emit_mutable(&wlr_renderer->events.lost, NULL);