Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 01/11] vulkan_filter: use GENERAL image layout when no sampler is given
@ 2025-02-17 18:31 Lynne
  2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 02/11] bwdif_vulkan: convert to storage images Lynne
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Lynne @ 2025-02-17 18:31 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Lynne

This allows using the generic filter code with STORAGE image inputs.
---
 libavfilter/vulkan_filter.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c
index bdbebb3cb2..ecb24711f3 100644
--- a/libavfilter/vulkan_filter.c
+++ b/libavfilter/vulkan_filter.c
@@ -249,6 +249,8 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
     VkImageView out_views[AV_NUM_DATA_POINTERS];
     VkImageMemoryBarrier2 img_bar[37];
     int nb_img_bar = 0;
+    VkImageLayout in_layout = sampler ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
+                                        VK_IMAGE_LAYOUT_GENERAL;
 
     /* Update descriptors and init the exec context */
     FFVkExecContext *exec = ff_vk_exec_get(vkctx, e);
@@ -267,8 +269,8 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
                                      VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
         RET(ff_vk_create_imageviews(vkctx, exec, in_views,  in_f, FF_VK_REP_FLOAT));
         ff_vk_shader_update_img_array(vkctx, exec, shd,  in_f,  in_views, 0, 0,
-                                          VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
-                                          sampler);
+                                      in_layout,
+                                      sampler);
     }
 
     /* Bind pipeline, update push data */
@@ -289,7 +291,7 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
                             VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
                             VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
                             VK_ACCESS_SHADER_READ_BIT,
-                            VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+                            in_layout,
                             VK_QUEUE_FAMILY_IGNORED);
 
     vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
@@ -321,6 +323,8 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
     VkImageView out_views[AV_NUM_DATA_POINTERS];
     VkImageMemoryBarrier2 img_bar[37];
     int nb_img_bar = 0;
+    VkImageLayout in_layout = sampler ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
+                                        VK_IMAGE_LAYOUT_GENERAL;
 
     /* Update descriptors and init the exec context */
     FFVkExecContext *exec = ff_vk_exec_get(vkctx, e);
@@ -344,7 +348,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
                         VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
                         VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
                         VK_ACCESS_SHADER_READ_BIT,
-                        VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+                        in_layout,
                         VK_QUEUE_FAMILY_IGNORED);
     ff_vk_frame_barrier(vkctx, exec, tmp, img_bar, &nb_img_bar,
                         VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
@@ -373,7 +377,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
         VkImageView *dst_views = !i ? tmp_views : out_views;
 
         ff_vk_shader_update_img_array(vkctx, exec, shd, src_f, src_views, 0, 0,
-                                      !i ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
+                                      !i ? in_layout :
                                            VK_IMAGE_LAYOUT_GENERAL,
                                       sampler);
         ff_vk_shader_update_img_array(vkctx, exec, shd, dst_f, dst_views, 0, 1,
@@ -409,6 +413,9 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
     VkImageView out_views[AV_NUM_DATA_POINTERS];
     VkImageMemoryBarrier2 img_bar[128];
     int nb_img_bar = 0;
+    VkImageLayout in_layout = sampler != VK_NULL_HANDLE ?
+                              VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
+                              VK_IMAGE_LAYOUT_GENERAL;
 
     /* Update descriptors and init the exec context */
     FFVkExecContext *exec = ff_vk_exec_get(vkctx, e);
@@ -432,7 +439,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
                                   VK_NULL_HANDLE);
     for (int i = 0; i < nb_in; i++)
         ff_vk_shader_update_img_array(vkctx, exec, shd, in[i], in_views[i], 0, i,
-                                      VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+                                      in_layout,
                                       sampler);
 
     /* Bind pipeline, update push data */
@@ -453,7 +460,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
                             VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
                             VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
                             VK_ACCESS_SHADER_READ_BIT,
-                            VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+                            in_layout,
                             VK_QUEUE_FAMILY_IGNORED);
 
     vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
-- 
2.47.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-02-17 20:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-17 18:31 [FFmpeg-devel] [PATCH 01/11] vulkan_filter: use GENERAL image layout when no sampler is given Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 02/11] bwdif_vulkan: convert to storage images Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 03/11] nlmeans_vulkan: switch to imageLoad() Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 04/11] avgblur_vulkan: port " Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 05/11] chromaber_vulkan: fix use of texture() Lynne
2025-02-17 20:03   ` Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 06/11] flip_vulkan: port to imageLoad() Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 07/11] gblur_vulkan: " Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 08/11] " Lynne
2025-02-17 19:49   ` Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 09/11] transpose_vulkan: " Lynne
2025-02-17 18:31 ` [FFmpeg-devel] [PATCH 10/11] blend_vulkan: " Lynne
2025-02-17 18:32 ` [FFmpeg-devel] [PATCH 11/11] overlay_vulkan: " Lynne

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git