aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-02-17 04:14:08 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:50 +0200
commit94e17a63a446d1c1dc5ae36fcf58fb43a6ef22fe (patch)
tree0cab42d942d82812f6b52abeee50f74fc0c7839c
parent32fc36ee6168e0e8fb36f69c97d5198603ae8ba5 (diff)
downloadffmpeg-94e17a63a446d1c1dc5ae36fcf58fb43a6ef22fe.tar.gz
hwcontext_vulkan: don't change properties if prepare_frame fails
-rw-r--r--libavutil/hwcontext_vulkan.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index a0139871c9..4eab89e93c 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2200,16 +2200,13 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
break;
}
- /* Change the image layout to something more optimal for writes.
- * This also signals the newly created semaphore, making it usable
- * for synchronization */
for (int i = 0; i < nb_images; i++) {
img_bar[i] = (VkImageMemoryBarrier2) {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
.pNext = NULL,
- .srcStageMask = VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT,
- .srcAccessMask = 0x0,
- .dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT,
+ .srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
+ .dstStageMask = VK_PIPELINE_STAGE_2_TRANSFER_BIT,
+ .srcAccessMask = frame->access[i],
.dstAccessMask = new_access,
.oldLayout = frame->layout[i],
.newLayout = new_layout,
@@ -2222,9 +2219,6 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
.levelCount = 1,
},
};
-
- frame->layout[i] = img_bar[i].newLayout;
- frame->access[i] = img_bar[i].dstAccessMask;
}
vk->CmdPipelineBarrier2(get_buf_exec_ctx(hwfc, ectx), &(VkDependencyInfo) {
@@ -2234,6 +2228,13 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
});
err = submit_exec_ctx(hwfc, ectx, &s_info, frame, 0);
+ if (err >= 0) {
+ for (int i = 0; i < nb_images; i++) {
+ frame->layout[i] = img_bar[i].newLayout;
+ frame->access[i] = img_bar[i].dstAccessMask;
+ frame->queue_family[i] = img_bar[i].dstQueueFamilyIndex;
+ }
+ }
vkfc->unlock_frame(hwfc, frame);
return err;