43 vk_frames = frames_ctx->
hwctx;
44 vk_dev = device_ctx->
hwctx;
56 if (vk_frames->
tiling != VK_IMAGE_TILING_OPTIMAL)
60 if ((vk_frames->
usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) !=
61 (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT))
72 for (
int i = 0; sub[
i] != VK_FORMAT_UNDEFINED;
i++) {
73 VkFormatProperties2 prop = {
74 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
76 vk->GetPhysicalDeviceFormatProperties2(vk_dev->
phys_dev, sub[
i],
79 if (vk_frames->
tiling == VK_IMAGE_TILING_LINEAR) {
80 no_storage |= !(prop.formatProperties.linearTilingFeatures &
81 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
83 no_storage |= !(prop.formatProperties.optimalTilingFeatures &
84 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
103 "Vulkan filtering requires a device context!\n");
115 vk_frames = frames_ctx->
hwctx;
116 vk_frames->
tiling = VK_IMAGE_TILING_OPTIMAL;
117 vk_frames->
usage = VK_IMAGE_USAGE_SAMPLED_BIT |
118 VK_IMAGE_USAGE_STORAGE_BIT |
119 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
120 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
129 vk_dev = device_ctx->
hwctx;
141 "the %s extension is supported!\n",
142 VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME);
153 s->frames_ref = frames_ref;
154 s->frames = frames_ctx;
156 s->device = device_ctx;
157 s->hwctx = device_ctx->
hwctx;
172 if (!
inlink->hw_frames_ctx) {
174 "hardware frames context on the input.\n");
187 s->input_frames_ref =
inlink->hw_frames_ctx;
206 s->output_width,
s->output_height,
215 outlink->
w =
s->output_width;
216 outlink->
h =
s->output_height;
232 VkSampler sampler,
void *push_src,
size_t push_size)
238 VkImageMemoryBarrier2 img_bar[37];
249 0, push_size, push_src);
253 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
254 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
257 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
260 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
261 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
262 VK_ACCESS_SHADER_READ_BIT,
263 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
264 VK_QUEUE_FAMILY_IGNORED);
268 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
269 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
272 VK_IMAGE_LAYOUT_GENERAL,
275 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
276 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
277 VK_ACCESS_SHADER_WRITE_BIT,
278 VK_IMAGE_LAYOUT_GENERAL,
279 VK_QUEUE_FAMILY_IGNORED);
281 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
282 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
283 .pImageMemoryBarriers = img_bar,
284 .imageMemoryBarrierCount = nb_img_bar,
287 vk->CmdDispatch(exec->
buf,
301 VkSampler sampler,
void *push_src,
size_t push_size)
308 VkImageMemoryBarrier2 img_bar[37];
316 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
317 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
319 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
320 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
322 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
323 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
330 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
331 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
332 VK_ACCESS_SHADER_READ_BIT,
333 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
334 VK_QUEUE_FAMILY_IGNORED);
336 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
337 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
338 VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
339 VK_IMAGE_LAYOUT_GENERAL,
340 VK_QUEUE_FAMILY_IGNORED);
342 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
343 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
344 VK_ACCESS_SHADER_WRITE_BIT,
345 VK_IMAGE_LAYOUT_GENERAL,
346 VK_QUEUE_FAMILY_IGNORED);
348 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
349 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
350 .pImageMemoryBarriers = img_bar,
351 .imageMemoryBarrierCount = nb_img_bar,
354 for (
int i = 0;
i < 2;
i++) {
358 VkImageView *src_views = !
i ? in_views : tmp_views;
359 VkImageView *dst_views = !
i ? tmp_views : out_views;
365 0, push_size, push_src);
368 !
i ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
369 VK_IMAGE_LAYOUT_GENERAL,
372 VK_IMAGE_LAYOUT_GENERAL,
375 vk->CmdDispatch(exec->
buf,
390 VkSampler sampler,
void *push_src,
size_t push_size)
396 VkImageMemoryBarrier2 img_bar[128];
404 for (
int i = 0;
i < nb_in;
i++) {
406 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
407 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
411 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
412 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
413 VK_ACCESS_SHADER_READ_BIT,
414 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
415 VK_QUEUE_FAMILY_IGNORED);
420 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
421 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
424 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
425 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
426 VK_ACCESS_SHADER_WRITE_BIT,
427 VK_IMAGE_LAYOUT_GENERAL,
428 VK_QUEUE_FAMILY_IGNORED);
430 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
431 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
432 .pImageMemoryBarriers = img_bar,
433 .imageMemoryBarrierCount = nb_img_bar,
440 0, push_size, push_src);
442 for (
int i = 0;
i < nb_in;
i++)
444 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
448 VK_IMAGE_LAYOUT_GENERAL,
451 vk->CmdDispatch(exec->
buf,