mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
Merge branch 'vk-omit-stage-cb' into 'master'
Draft: render/vulkan: omit stage command buffer if empty See merge request wlroots/wlroots!4077
This commit is contained in:
commit
07ae9bc90f
1 changed files with 19 additions and 16 deletions
|
|
@ -901,12 +901,7 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
assert(render_cb != NULL);
|
assert(render_cb != NULL);
|
||||||
renderer->current_command_buffer = NULL;
|
renderer->current_command_buffer = NULL;
|
||||||
|
|
||||||
if (vulkan_record_stage_cb(renderer) == VK_NULL_HANDLE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_vk_command_buffer *stage_cb = renderer->stage.cb;
|
struct wlr_vk_command_buffer *stage_cb = renderer->stage.cb;
|
||||||
assert(stage_cb != NULL);
|
|
||||||
renderer->stage.cb = NULL;
|
renderer->stage.cb = NULL;
|
||||||
|
|
||||||
renderer->render_width = 0u;
|
renderer->render_width = 0u;
|
||||||
|
|
@ -1026,7 +1021,7 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
|
|
||||||
vkCmdPipelineBarrier(stage_cb->vk, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
vkCmdPipelineBarrier(render_cb->vk, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||||
0, 0, NULL, 0, NULL, barrier_count, acquire_barriers);
|
0, 0, NULL, 0, NULL, barrier_count, acquire_barriers);
|
||||||
|
|
||||||
|
|
@ -1057,24 +1052,30 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
// We don't need a semaphore from the stage/transfer submission
|
// We don't need a semaphore from the stage/transfer submission
|
||||||
// to the render submissions since they are on the same queue
|
// to the render submissions since they are on the same queue
|
||||||
// and we have a renderpass dependency for that.
|
// and we have a renderpass dependency for that.
|
||||||
uint64_t stage_timeline_point = end_command_buffer(stage_cb, renderer);
|
uint64_t stage_timeline_point = 0;
|
||||||
if (stage_timeline_point == 0) {
|
if (stage_cb != VK_NULL_HANDLE) {
|
||||||
return;
|
stage_timeline_point = end_command_buffer(stage_cb, renderer);
|
||||||
|
if (stage_timeline_point == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VkTimelineSemaphoreSubmitInfoKHR stage_timeline_submit_info = {
|
VkTimelineSemaphoreSubmitInfoKHR stage_timeline_submit_info = {
|
||||||
.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR,
|
.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR,
|
||||||
.signalSemaphoreValueCount = 1,
|
|
||||||
.pSignalSemaphoreValues = &stage_timeline_point,
|
|
||||||
};
|
};
|
||||||
*stage_sub = (VkSubmitInfo){
|
*stage_sub = (VkSubmitInfo){
|
||||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||||
.pNext = &stage_timeline_submit_info,
|
.pNext = &stage_timeline_submit_info,
|
||||||
.commandBufferCount = 1,
|
|
||||||
.pCommandBuffers = &stage_cb->vk,
|
|
||||||
.signalSemaphoreCount = 1,
|
|
||||||
.pSignalSemaphores = &renderer->timeline_semaphore,
|
|
||||||
};
|
};
|
||||||
|
if (stage_cb != VK_NULL_HANDLE) {
|
||||||
|
assert(stage_timeline_point > 0);
|
||||||
|
stage_sub->commandBufferCount = 1;
|
||||||
|
stage_sub->pCommandBuffers = &stage_cb->vk;
|
||||||
|
stage_sub->signalSemaphoreCount = 1;
|
||||||
|
stage_sub->pSignalSemaphores = &renderer->timeline_semaphore;
|
||||||
|
stage_timeline_submit_info.signalSemaphoreValueCount = 1;
|
||||||
|
stage_timeline_submit_info.pSignalSemaphoreValues = &stage_timeline_point;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t stage_wait_timeline_point;
|
uint64_t stage_wait_timeline_point;
|
||||||
VkPipelineStageFlags stage_wait_stage;
|
VkPipelineStageFlags stage_wait_stage;
|
||||||
|
|
@ -1088,7 +1089,9 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
stage_timeline_submit_info.pWaitSemaphoreValues = &stage_wait_timeline_point;
|
stage_timeline_submit_info.pWaitSemaphoreValues = &stage_wait_timeline_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->stage.last_timeline_point = stage_timeline_point;
|
if (stage_timeline_point > 0) {
|
||||||
|
renderer->stage.last_timeline_point = stage_timeline_point;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t render_timeline_point = end_command_buffer(render_cb, renderer);
|
uint64_t render_timeline_point = end_command_buffer(render_cb, renderer);
|
||||||
if (render_timeline_point == 0) {
|
if (render_timeline_point == 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue