Unified · Split
| @@ -303,32 +303,30 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f) · 302 unmodified lines | ||
| 303 | 303 | AVVkFrame *out = (AVVkFrame *)out_f->data[0]; |
| 304 | 304 | VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2]; |
| 305 | 305 | int barrier_count = 0; |
| 306 | + const int planes = av_pix_fmt_count_planes(s->vkctx.input_format); | |
| 306 | 307 | |
| 307 | 308 | /* Update descriptors and init the exec context */ |
| 308 | 309 | ff_vk_start_exec_recording(vkctx, s->exec); |
| 309 | 310 | cmd_buf = ff_vk_get_exec_buf(s->exec); |
| 310 | 311 | |
| 311 | − for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) { | |
| 312 | + for (int i = 0; i < planes; i++) { | |
| 312 | 313 | RET(ff_vk_create_imageview(vkctx, s->exec, |
| 313 | 314 | &s->input_images[i].imageView, in->img[i], |
| 314 | 315 | av_vkfmt_from_pixfmt(s->vkctx.input_format)[i], |
| 315 | 316 | ff_comp_identity_map)); |
| 316 | 317 | |
| 317 | − s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; | |
| 318 | − } | |
| 319 | − | |
| 320 | − for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.output_format); i++) { | |
| 321 | 318 | RET(ff_vk_create_imageview(vkctx, s->exec, |
| 322 | 319 | &s->output_images[i].imageView, out->img[i], |
| 323 | 320 | av_vkfmt_from_pixfmt(s->vkctx.output_format)[i], |
| 324 | 321 | ff_comp_identity_map)); |
| 325 | 322 | |
| 323 | + s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; | |
| 326 | 324 | s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL; |
| 327 | 325 | } |
| 328 | 326 | |
| 329 | 327 | ff_vk_update_descriptor_set(vkctx, s->pl, 0); |
| 330 | 328 | |
| 331 | − for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) { | |
| 329 | + for (int i = 0; i < planes; i++) { | |
| 332 | 330 | VkImageMemoryBarrier bar = { |
| 333 | 331 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, |
| 334 | 332 | .srcAccessMask = 0, |