42 vk_frames = frames_ctx->
hwctx;
43 vk_dev = device_ctx->
hwctx;
55 if (vk_frames->
tiling != VK_IMAGE_TILING_OPTIMAL)
59 if ((vk_frames->
usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) !=
60 (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT))
71 for (
int i = 0; sub[
i] != VK_FORMAT_UNDEFINED;
i++) {
72 VkFormatProperties2 prop = {
73 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
75 vk->GetPhysicalDeviceFormatProperties2(vk_dev->
phys_dev, sub[
i],
78 if (vk_frames->
tiling == VK_IMAGE_TILING_LINEAR) {
79 no_storage |= !(prop.formatProperties.linearTilingFeatures &
80 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
82 no_storage |= !(prop.formatProperties.optimalTilingFeatures &
83 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT);
102 "Vulkan filtering requires a device context!\n");
114 vk_frames = frames_ctx->
hwctx;
115 vk_frames->
tiling = VK_IMAGE_TILING_OPTIMAL;
116 vk_frames->
usage = VK_IMAGE_USAGE_SAMPLED_BIT |
117 VK_IMAGE_USAGE_STORAGE_BIT |
118 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
119 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
128 vk_dev = device_ctx->
hwctx;
140 "the %s extension is supported!\n",
141 VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME);
152 s->frames_ref = frames_ref;
153 s->frames = frames_ctx;
155 s->device = device_ctx;
156 s->hwctx = device_ctx->
hwctx;
171 if (!
inlink->hw_frames_ctx) {
173 "hardware frames context on the input.\n");
186 s->input_frames_ref =
inlink->hw_frames_ctx;
204 s->output_width,
s->output_height,
213 outlink->
w =
s->output_width;
214 outlink->
h =
s->output_height;
230 VkSampler sampler,
void *push_src,
size_t push_size)
236 VkImageMemoryBarrier2 img_bar[37];
247 0, push_size, push_src);
251 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
252 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
255 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
258 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
259 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
260 VK_ACCESS_SHADER_READ_BIT,
261 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
262 VK_QUEUE_FAMILY_IGNORED);
266 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
267 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
270 VK_IMAGE_LAYOUT_GENERAL,
273 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
274 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
275 VK_ACCESS_SHADER_WRITE_BIT,
276 VK_IMAGE_LAYOUT_GENERAL,
277 VK_QUEUE_FAMILY_IGNORED);
279 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
280 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
281 .pImageMemoryBarriers = img_bar,
282 .imageMemoryBarrierCount = nb_img_bar,
285 vk->CmdDispatch(exec->
buf,
299 VkSampler sampler,
void *push_src,
size_t push_size)
306 VkImageMemoryBarrier2 img_bar[37];
314 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
315 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
317 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
318 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
320 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
321 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
328 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
329 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
330 VK_ACCESS_SHADER_READ_BIT,
331 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
332 VK_QUEUE_FAMILY_IGNORED);
334 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
335 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
336 VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
337 VK_IMAGE_LAYOUT_GENERAL,
338 VK_QUEUE_FAMILY_IGNORED);
340 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
341 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
342 VK_ACCESS_SHADER_WRITE_BIT,
343 VK_IMAGE_LAYOUT_GENERAL,
344 VK_QUEUE_FAMILY_IGNORED);
346 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
347 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
348 .pImageMemoryBarriers = img_bar,
349 .imageMemoryBarrierCount = nb_img_bar,
352 for (
int i = 0;
i < 2;
i++) {
356 VkImageView *src_views = !
i ? in_views : tmp_views;
357 VkImageView *dst_views = !
i ? tmp_views : out_views;
363 0, push_size, push_src);
366 !
i ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :
367 VK_IMAGE_LAYOUT_GENERAL,
370 VK_IMAGE_LAYOUT_GENERAL,
373 vk->CmdDispatch(exec->
buf,
388 VkSampler sampler,
void *push_src,
size_t push_size)
394 VkImageMemoryBarrier2 img_bar[128];
402 for (
int i = 0;
i < nb_in;
i++) {
404 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
405 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
409 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
410 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
411 VK_ACCESS_SHADER_READ_BIT,
412 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
413 VK_QUEUE_FAMILY_IGNORED);
418 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
419 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
422 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
423 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
424 VK_ACCESS_SHADER_WRITE_BIT,
425 VK_IMAGE_LAYOUT_GENERAL,
426 VK_QUEUE_FAMILY_IGNORED);
428 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
429 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
430 .pImageMemoryBarriers = img_bar,
431 .imageMemoryBarrierCount = nb_img_bar,
438 0, push_size, push_src);
440 for (
int i = 0;
i < nb_in;
i++)
442 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
446 VK_IMAGE_LAYOUT_GENERAL,
449 vk->CmdDispatch(exec->
buf,