This allows using the generic filter code with STORAGE image inputs.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -249,6 +249,9 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, · 248 unmodified lines | ||
| 249 | 249 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 250 | 250 | VkImageMemoryBarrier2 img_bar[37]; |
| 251 | 251 | int nb_img_bar = 0; |
| 252 | + VkImageLayout in_layout = sampler != VK_NULL_HANDLE ? | |
| 253 | + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : | |
| 254 | + VK_IMAGE_LAYOUT_GENERAL; | |
| 252 | 255 | |
| 253 | 256 | /* Update descriptors and init the exec context */ |
| 254 | 257 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); |
| @@ -267,8 +270,8 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, · 12 unmodified lines | ||
| 267 | 270 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT)); |
| 268 | 271 | RET(ff_vk_create_imageviews(vkctx, exec, in_views, in_f, FF_VK_REP_FLOAT)); |
| 269 | 272 | ff_vk_shader_update_img_array(vkctx, exec, shd, in_f, in_views, 0, 0, |
| 270 | − VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | |
| 271 | − sampler); | |
| 273 | + in_layout, | |
| 274 | + sampler); | |
| 272 | 275 | } |
| 273 | 276 | |
| 274 | 277 | /* Bind pipeline, update push data */ |
| @@ -289,7 +292,7 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, · 14 unmodified lines | ||
| 289 | 292 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 290 | 293 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 291 | 294 | VK_ACCESS_SHADER_READ_BIT, |
| 292 | − VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | |
| 295 | + in_layout, | |
| 293 | 296 | VK_QUEUE_FAMILY_IGNORED); |
| 294 | 297 | |
| 295 | 298 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { |
| @@ -321,6 +324,9 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, · 25 unmodified lines | ||
| 321 | 324 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 322 | 325 | VkImageMemoryBarrier2 img_bar[37]; |
| 323 | 326 | int nb_img_bar = 0; |
| 327 | + VkImageLayout in_layout = sampler != VK_NULL_HANDLE ? | |
| 328 | + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : | |
| 329 | + VK_IMAGE_LAYOUT_GENERAL; | |
| 324 | 330 | |
| 325 | 331 | /* Update descriptors and init the exec context */ |
| 326 | 332 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); |
| @@ -344,7 +350,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, · 17 unmodified lines | ||
| 344 | 350 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 345 | 351 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 346 | 352 | VK_ACCESS_SHADER_READ_BIT, |
| 347 | − VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | |
| 353 | + in_layout, | |
| 348 | 354 | VK_QUEUE_FAMILY_IGNORED); |
| 349 | 355 | ff_vk_frame_barrier(vkctx, exec, tmp, img_bar, &nb_img_bar, |
| 350 | 356 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| @@ -373,7 +379,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, · 22 unmodified lines | ||
| 373 | 379 | VkImageView *dst_views = !i ? tmp_views : out_views; |
| 374 | 380 | |
| 375 | 381 | ff_vk_shader_update_img_array(vkctx, exec, shd, src_f, src_views, 0, 0, |
| 376 | − !i ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : | |
| 382 | + !i ? in_layout : | |
| 377 | 383 | VK_IMAGE_LAYOUT_GENERAL, |
| 378 | 384 | sampler); |
| 379 | 385 | ff_vk_shader_update_img_array(vkctx, exec, shd, dst_f, dst_views, 0, 1, |
| @@ -409,6 +415,9 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, · 29 unmodified lines | ||
| 409 | 415 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 410 | 416 | VkImageMemoryBarrier2 img_bar[128]; |
| 411 | 417 | int nb_img_bar = 0; |
| 418 | + VkImageLayout in_layout = sampler != VK_NULL_HANDLE ? | |
| 419 | + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : | |
| 420 | + VK_IMAGE_LAYOUT_GENERAL; | |
| 412 | 421 | |
| 413 | 422 | /* Update descriptors and init the exec context */ |
| 414 | 423 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); |
| @@ -432,7 +441,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, · 17 unmodified lines | ||
| 432 | 441 | VK_NULL_HANDLE); |
| 433 | 442 | for (int i = 0; i < nb_in; i++) |
| 434 | 443 | ff_vk_shader_update_img_array(vkctx, exec, shd, in[i], in_views[i], 0, i, |
| 435 | − VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | |
| 444 | + in_layout, | |
| 436 | 445 | sampler); |
| 437 | 446 | |
| 438 | 447 | /* Bind pipeline, update push data */ |
| @@ -453,7 +462,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, · 14 unmodified lines | ||
| 453 | 462 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 454 | 463 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 455 | 464 | VK_ACCESS_SHADER_READ_BIT, |
| 456 | − VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | |
| 465 | + in_layout, | |
| 457 | 466 | VK_QUEUE_FAMILY_IGNORED); |
| 458 | 467 | |
| 459 | 468 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { |