This allows using the generic filter code with STORAGE image inputs.
Unified · Split
| @@ -249,6 +249,9 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, · 248 unmodified lines | |||
| 249 | VkImageView out_views[AV_NUM_DATA_POINTERS]; | 249 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 250 | VkImageMemoryBarrier2 img_bar[37]; | 250 | VkImageMemoryBarrier2 img_bar[37]; |
| 251 | int nb_img_bar = 0; | 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 | /* Update descriptors and init the exec context */ | 256 | /* Update descriptors and init the exec context */ |
| 254 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); | 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 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT)); | 270 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT)); |
| 268 | RET(ff_vk_create_imageviews(vkctx, exec, in_views, in_f, FF_VK_REP_FLOAT)); | 271 | RET(ff_vk_create_imageviews(vkctx, exec, in_views, in_f, FF_VK_REP_FLOAT)); |
| 269 | ff_vk_shader_update_img_array(vkctx, exec, shd, in_f, in_views, 0, 0, | 272 | ff_vk_shader_update_img_array(vkctx, exec, shd, in_f, in_views, 0, 0, |
| 270 | VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | 273 | in_layout, |
| 271 | sampler); | 274 | sampler); |
| 272 | } | 275 | } |
| 273 | 276 | ||
| 274 | /* Bind pipeline, update push data */ | 277 | /* Bind pipeline, update push data */ |
| @@ -289,7 +292,7 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e, · 14 unmodified lines | |||
| 289 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, | 292 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 290 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, | 293 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 291 | VK_ACCESS_SHADER_READ_BIT, | 294 | VK_ACCESS_SHADER_READ_BIT, |
| 292 | VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | 295 | in_layout, |
| 293 | VK_QUEUE_FAMILY_IGNORED); | 296 | VK_QUEUE_FAMILY_IGNORED); |
| 294 | 297 | ||
| 295 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { | 298 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { |
| @@ -321,6 +324,9 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e, · 25 unmodified lines | |||
| 321 | VkImageView out_views[AV_NUM_DATA_POINTERS]; | 324 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 322 | VkImageMemoryBarrier2 img_bar[37]; | 325 | VkImageMemoryBarrier2 img_bar[37]; |
| 323 | int nb_img_bar = 0; | 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 | /* Update descriptors and init the exec context */ | 331 | /* Update descriptors and init the exec context */ |
| 326 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); | 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 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, | 350 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 345 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, | 351 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 346 | VK_ACCESS_SHADER_READ_BIT, | 352 | VK_ACCESS_SHADER_READ_BIT, |
| 347 | VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | 353 | in_layout, |
| 348 | VK_QUEUE_FAMILY_IGNORED); | 354 | VK_QUEUE_FAMILY_IGNORED); |
| 349 | ff_vk_frame_barrier(vkctx, exec, tmp, img_bar, &nb_img_bar, | 355 | ff_vk_frame_barrier(vkctx, exec, tmp, img_bar, &nb_img_bar, |
| 350 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, | 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 | VkImageView *dst_views = !i ? tmp_views : out_views; | 379 | VkImageView *dst_views = !i ? tmp_views : out_views; |
| 374 | 380 | ||
| 375 | ff_vk_shader_update_img_array(vkctx, exec, shd, src_f, src_views, 0, 0, | 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 | VK_IMAGE_LAYOUT_GENERAL, | 383 | VK_IMAGE_LAYOUT_GENERAL, |
| 378 | sampler); | 384 | sampler); |
| 379 | ff_vk_shader_update_img_array(vkctx, exec, shd, dst_f, dst_views, 0, 1, | 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 | VkImageView out_views[AV_NUM_DATA_POINTERS]; | 415 | VkImageView out_views[AV_NUM_DATA_POINTERS]; |
| 410 | VkImageMemoryBarrier2 img_bar[128]; | 416 | VkImageMemoryBarrier2 img_bar[128]; |
| 411 | int nb_img_bar = 0; | 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 | /* Update descriptors and init the exec context */ | 422 | /* Update descriptors and init the exec context */ |
| 414 | FFVkExecContext *exec = ff_vk_exec_get(vkctx, e); | 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 | VK_NULL_HANDLE); | 441 | VK_NULL_HANDLE); |
| 433 | for (int i = 0; i < nb_in; i++) | 442 | for (int i = 0; i < nb_in; i++) |
| 434 | ff_vk_shader_update_img_array(vkctx, exec, shd, in[i], in_views[i], 0, i, | 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 | sampler); | 445 | sampler); |
| 437 | 446 | ||
| 438 | /* Bind pipeline, update push data */ | 447 | /* Bind pipeline, update push data */ |
| @@ -453,7 +462,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, · 14 unmodified lines | |||
| 453 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, | 462 | VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, |
| 454 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, | 463 | VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, |
| 455 | VK_ACCESS_SHADER_READ_BIT, | 464 | VK_ACCESS_SHADER_READ_BIT, |
| 456 | VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, | 465 | in_layout, |
| 457 | VK_QUEUE_FAMILY_IGNORED); | 466 | VK_QUEUE_FAMILY_IGNORED); |
| 458 | 467 | ||
| 459 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { | 468 | vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) { |