aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2021-11-19 15:13:35 +0100
committerLynne <dev@lynne.ee>2021-11-19 16:47:26 +0100
commitf6dd30df242cbf0a59c9ddfe66b23dc0ddaede66 (patch)
treeca79fdef17d0a709e24e005f96a6d05c660d5503
parente7f3279ba0ecd89eded5f91cb3bf5754761966db (diff)
downloadffmpeg-f6dd30df242cbf0a59c9ddfe66b23dc0ddaede66.tar.gz
lavfi/vulkan: split off lavfi-specific code into vulkan_filter.c
The issue is that libavfilter depends on libavcodec, and when doing a static build, if libavcodec also includes "libavfilter/vulkan.c", then during link-time, compiling programs will fail as there would be multiple definitions of the same symbols in both libavfilter and libavcodec's object files. Linkers are, however, more permitting if both files that include a common file that's used as a template are one-to-one identical. Hence, to make both files the same in the future, export all avfilter specific functions to a separate file. There is some work in progress to make templated files like this be compiled only once, so this is not a long-term solution. This also removes a macro that could be used to toggle SPIRV compilation capability on #include-time, as this could cause the files to be different.
-rw-r--r--libavfilter/Makefile12
-rw-r--r--libavfilter/vf_avgblur_vulkan.c2
-rw-r--r--libavfilter/vf_chromaber_vulkan.c2
-rw-r--r--libavfilter/vf_gblur_vulkan.c2
-rw-r--r--libavfilter/vf_libplacebo.c2
-rw-r--r--libavfilter/vf_overlay_vulkan.c2
-rw-r--r--libavfilter/vf_scale_vulkan.c2
-rw-r--r--libavfilter/vulkan.c173
-rw-r--r--libavfilter/vulkan.h9
-rw-r--r--libavfilter/vulkan_filter.c191
-rw-r--r--libavfilter/vulkan_filter.h34
-rw-r--r--libavutil/vulkan.c4
-rw-r--r--libavutil/vulkan.h5
13 files changed, 240 insertions, 200 deletions
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 868ba68b79..56ffe44c3e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -180,7 +180,7 @@ OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o
OBJS-$(CONFIG_AVGBLUR_FILTER) += vf_avgblur.o
OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \
opencl/avgblur.o boxblur.o
-OBJS-$(CONFIG_AVGBLUR_VULKAN_FILTER) += vf_avgblur_vulkan.o vulkan.o
+OBJS-$(CONFIG_AVGBLUR_VULKAN_FILTER) += vf_avgblur_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_BBOX_FILTER) += bbox.o vf_bbox.o
OBJS-$(CONFIG_BENCH_FILTER) += f_bench.o
OBJS-$(CONFIG_BILATERAL_FILTER) += vf_bilateral.o
@@ -194,7 +194,7 @@ OBJS-$(CONFIG_BOXBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \
opencl/avgblur.o boxblur.o
OBJS-$(CONFIG_BWDIF_FILTER) += vf_bwdif.o yadif_common.o
OBJS-$(CONFIG_CAS_FILTER) += vf_cas.o
-OBJS-$(CONFIG_CHROMABER_VULKAN_FILTER) += vf_chromaber_vulkan.o vulkan.o
+OBJS-$(CONFIG_CHROMABER_VULKAN_FILTER) += vf_chromaber_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_CHROMAHOLD_FILTER) += vf_chromakey.o
OBJS-$(CONFIG_CHROMAKEY_FILTER) += vf_chromakey.o
OBJS-$(CONFIG_CHROMANR_FILTER) += vf_chromanr.o
@@ -289,7 +289,7 @@ OBJS-$(CONFIG_FREEZEFRAMES_FILTER) += vf_freezeframes.o
OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o qp_table.o
OBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o
-OBJS-$(CONFIG_GBLUR_VULKAN_FILTER) += vf_gblur_vulkan.o vulkan.o
+OBJS-$(CONFIG_GBLUR_VULKAN_FILTER) += vf_gblur_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_GEQ_FILTER) += vf_geq.o
OBJS-$(CONFIG_GRADFUN_FILTER) += vf_gradfun.o
OBJS-$(CONFIG_GRAPHMONITOR_FILTER) += f_graphmonitor.o
@@ -324,7 +324,7 @@ OBJS-$(CONFIG_LAGFUN_FILTER) += vf_lagfun.o
OBJS-$(CONFIG_LATENCY_FILTER) += f_latency.o
OBJS-$(CONFIG_LENSCORRECTION_FILTER) += vf_lenscorrection.o
OBJS-$(CONFIG_LENSFUN_FILTER) += vf_lensfun.o
-OBJS-$(CONFIG_LIBPLACEBO_FILTER) += vf_libplacebo.o vulkan.o
+OBJS-$(CONFIG_LIBPLACEBO_FILTER) += vf_libplacebo.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_LIBVMAF_FILTER) += vf_libvmaf.o framesync.o
OBJS-$(CONFIG_LIMITDIFF_FILTER) += vf_limitdiff.o framesync.o
OBJS-$(CONFIG_LIMITER_FILTER) += vf_limiter.o
@@ -370,7 +370,7 @@ OBJS-$(CONFIG_OVERLAY_CUDA_FILTER) += vf_overlay_cuda.o framesync.o vf
OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o opencl.o \
opencl/overlay.o framesync.o
OBJS-$(CONFIG_OVERLAY_QSV_FILTER) += vf_overlay_qsv.o framesync.o
-OBJS-$(CONFIG_OVERLAY_VULKAN_FILTER) += vf_overlay_vulkan.o vulkan.o
+OBJS-$(CONFIG_OVERLAY_VULKAN_FILTER) += vf_overlay_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_OWDENOISE_FILTER) += vf_owdenoise.o
OBJS-$(CONFIG_PAD_FILTER) += vf_pad.o
OBJS-$(CONFIG_PAD_OPENCL_FILTER) += vf_pad_opencl.o opencl.o opencl/pad.o
@@ -415,7 +415,7 @@ OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o scale_eval.o \
OBJS-$(CONFIG_SCALE_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_scale_qsv.o
OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o scale_eval.o vaapi_vpp.o
-OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o vulkan.o
+OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o vulkan.o vulkan_filter.o
OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale_eval.o
OBJS-$(CONFIG_SCALE2REF_NPP_FILTER) += vf_scale_npp.o scale_eval.o
OBJS-$(CONFIG_SCDET_FILTER) += vf_scdet.o
diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index d37d5a62b1..930f2a2bd9 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -18,7 +18,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "internal.h"
#define CGS 32
diff --git a/libavfilter/vf_chromaber_vulkan.c b/libavfilter/vf_chromaber_vulkan.c
index 86a66454a4..03e493bc7f 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -18,7 +18,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "internal.h"
#define CGROUPS (int [3]){ 32, 32, 1 }
diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
index 71d88d22e9..a2e33d1c90 100644
--- a/libavfilter/vf_gblur_vulkan.c
+++ b/libavfilter/vf_gblur_vulkan.c
@@ -19,7 +19,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "internal.h"
#define CGS 32
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index fe301db417..e2749857d1 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -19,7 +19,7 @@
#include "libavutil/file.h"
#include "libavutil/opt.h"
#include "internal.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "scale_eval.h"
#include <libplacebo/renderer.h>
diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
index ab97cf2c17..4308574f05 100644
--- a/libavfilter/vf_overlay_vulkan.c
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -18,7 +18,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "internal.h"
#include "framesync.h"
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index c2f6fe85e2..2eac901b1b 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -18,7 +18,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
-#include "vulkan.h"
+#include "vulkan_filter.h"
#include "scale_eval.h"
#include "internal.h"
#include "colorspace.h"
diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c
index 08e0c37cc4..fc8a1fa47b 100644
--- a/libavfilter/vulkan.c
+++ b/libavfilter/vulkan.c
@@ -16,177 +16,4 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "vulkan.h"
#include "libavutil/vulkan.c"
-
-static int vulkan_filter_set_device(AVFilterContext *avctx,
- AVBufferRef *device)
-{
- FFVulkanContext *s = avctx->priv;
-
- av_buffer_unref(&s->device_ref);
-
- s->device_ref = av_buffer_ref(device);
- if (!s->device_ref)
- return AVERROR(ENOMEM);
-
- s->device = (AVHWDeviceContext*)s->device_ref->data;
- s->hwctx = s->device->hwctx;
-
- return 0;
-}
-
-static int vulkan_filter_set_frames(AVFilterContext *avctx,
- AVBufferRef *frames)
-{
- FFVulkanContext *s = avctx->priv;
-
- av_buffer_unref(&s->frames_ref);
-
- s->frames_ref = av_buffer_ref(frames);
- if (!s->frames_ref)
- return AVERROR(ENOMEM);
-
- return 0;
-}
-
-int ff_vk_filter_config_input(AVFilterLink *inlink)
-{
- int err;
- AVFilterContext *avctx = inlink->dst;
- FFVulkanContext *s = avctx->priv;
- FFVulkanFunctions *vk = &s->vkfn;
- AVHWFramesContext *input_frames;
-
- if (!inlink->hw_frames_ctx) {
- av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
- "hardware frames context on the input.\n");
- return AVERROR(EINVAL);
- }
-
- /* Extract the device and default output format from the first input. */
- if (avctx->inputs[0] != inlink)
- return 0;
-
- input_frames = (AVHWFramesContext *)inlink->hw_frames_ctx->data;
- if (input_frames->format != AV_PIX_FMT_VULKAN)
- return AVERROR(EINVAL);
-
- err = vulkan_filter_set_device(avctx, input_frames->device_ref);
- if (err < 0)
- return err;
- err = vulkan_filter_set_frames(avctx, inlink->hw_frames_ctx);
- if (err < 0)
- return err;
-
- s->extensions = ff_vk_extensions_to_mask(s->hwctx->enabled_dev_extensions,
- s->hwctx->nb_enabled_dev_extensions);
-
- err = ff_vk_load_functions(s->device, &s->vkfn, s->extensions, 1, 1);
- if (err < 0)
- return err;
-
- vk->GetPhysicalDeviceProperties(s->hwctx->phys_dev, &s->props);
- vk->GetPhysicalDeviceMemoryProperties(s->hwctx->phys_dev, &s->mprops);
-
- /* Default output parameters match input parameters. */
- s->input_format = input_frames->sw_format;
- if (s->output_format == AV_PIX_FMT_NONE)
- s->output_format = input_frames->sw_format;
- if (!s->output_width)
- s->output_width = inlink->w;
- if (!s->output_height)
- s->output_height = inlink->h;
-
- return 0;
-}
-
-int ff_vk_filter_config_output_inplace(AVFilterLink *outlink)
-{
- int err;
- AVFilterContext *avctx = outlink->src;
- FFVulkanContext *s = avctx->priv;
-
- av_buffer_unref(&outlink->hw_frames_ctx);
-
- if (!s->device_ref) {
- if (!avctx->hw_device_ctx) {
- av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
- "Vulkan device.\n");
- return AVERROR(EINVAL);
- }
-
- err = vulkan_filter_set_device(avctx, avctx->hw_device_ctx);
- if (err < 0)
- return err;
- }
-
- outlink->hw_frames_ctx = av_buffer_ref(s->frames_ref);
- if (!outlink->hw_frames_ctx)
- return AVERROR(ENOMEM);
-
- outlink->w = s->output_width;
- outlink->h = s->output_height;
-
- return 0;
-}
-
-int ff_vk_filter_config_output(AVFilterLink *outlink)
-{
- int err;
- AVFilterContext *avctx = outlink->src;
- FFVulkanContext *s = avctx->priv;
- AVBufferRef *output_frames_ref;
- AVHWFramesContext *output_frames;
-
- av_buffer_unref(&outlink->hw_frames_ctx);
-
- if (!s->device_ref) {
- if (!avctx->hw_device_ctx) {
- av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
- "Vulkan device.\n");
- return AVERROR(EINVAL);
- }
-
- err = vulkan_filter_set_device(avctx, avctx->hw_device_ctx);
- if (err < 0)
- return err;
- }
-
- output_frames_ref = av_hwframe_ctx_alloc(s->device_ref);
- if (!output_frames_ref) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
- output_frames = (AVHWFramesContext*)output_frames_ref->data;
-
- output_frames->format = AV_PIX_FMT_VULKAN;
- output_frames->sw_format = s->output_format;
- output_frames->width = s->output_width;
- output_frames->height = s->output_height;
-
- err = av_hwframe_ctx_init(output_frames_ref);
- if (err < 0) {
- av_log(avctx, AV_LOG_ERROR, "Failed to initialise output "
- "frames: %d.\n", err);
- goto fail;
- }
-
- outlink->hw_frames_ctx = output_frames_ref;
- outlink->w = s->output_width;
- outlink->h = s->output_height;
-
- return 0;
-fail:
- av_buffer_unref(&output_frames_ref);
- return err;
-}
-
-int ff_vk_filter_init(AVFilterContext *avctx)
-{
- FFVulkanContext *s = avctx->priv;
-
- s->output_format = AV_PIX_FMT_NONE;
-
- return 0;
-}
diff --git a/libavfilter/vulkan.h b/libavfilter/vulkan.h
index 39c139cafa..928b2e21c3 100644
--- a/libavfilter/vulkan.h
+++ b/libavfilter/vulkan.h
@@ -19,15 +19,6 @@
#ifndef AVFILTER_VULKAN_H
#define AVFILTER_VULKAN_H
-#include "avfilter.h"
#include "libavutil/vulkan.h"
-/**
- * General lavfi IO functions
- */
-int ff_vk_filter_init (AVFilterContext *avctx);
-int ff_vk_filter_config_input (AVFilterLink *inlink);
-int ff_vk_filter_config_output (AVFilterLink *outlink);
-int ff_vk_filter_config_output_inplace(AVFilterLink *outlink);
-
#endif /* AVFILTER_VULKAN_H */
diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c
new file mode 100644
index 0000000000..e22541bd23
--- /dev/null
+++ b/libavfilter/vulkan_filter.c
@@ -0,0 +1,191 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "vulkan_filter.h"
+
+static int vulkan_filter_set_device(AVFilterContext *avctx,
+ AVBufferRef *device)
+{
+ FFVulkanContext *s = avctx->priv;
+
+ av_buffer_unref(&s->device_ref);
+
+ s->device_ref = av_buffer_ref(device);
+ if (!s->device_ref)
+ return AVERROR(ENOMEM);
+
+ s->device = (AVHWDeviceContext*)s->device_ref->data;
+ s->hwctx = s->device->hwctx;
+
+ return 0;
+}
+
+static int vulkan_filter_set_frames(AVFilterContext *avctx,
+ AVBufferRef *frames)
+{
+ FFVulkanContext *s = avctx->priv;
+
+ av_buffer_unref(&s->frames_ref);
+
+ s->frames_ref = av_buffer_ref(frames);
+ if (!s->frames_ref)
+ return AVERROR(ENOMEM);
+
+ return 0;
+}
+
+int ff_vk_filter_config_input(AVFilterLink *inlink)
+{
+ int err;
+ AVFilterContext *avctx = inlink->dst;
+ FFVulkanContext *s = avctx->priv;
+ FFVulkanFunctions *vk = &s->vkfn;
+ AVHWFramesContext *input_frames;
+
+ if (!inlink->hw_frames_ctx) {
+ av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
+ "hardware frames context on the input.\n");
+ return AVERROR(EINVAL);
+ }
+
+ /* Extract the device and default output format from the first input. */
+ if (avctx->inputs[0] != inlink)
+ return 0;
+
+ input_frames = (AVHWFramesContext *)inlink->hw_frames_ctx->data;
+ if (input_frames->format != AV_PIX_FMT_VULKAN)
+ return AVERROR(EINVAL);
+
+ err = vulkan_filter_set_device(avctx, input_frames->device_ref);
+ if (err < 0)
+ return err;
+ err = vulkan_filter_set_frames(avctx, inlink->hw_frames_ctx);
+ if (err < 0)
+ return err;
+
+ s->extensions = ff_vk_extensions_to_mask(s->hwctx->enabled_dev_extensions,
+ s->hwctx->nb_enabled_dev_extensions);
+
+ err = ff_vk_load_functions(s->device, &s->vkfn, s->extensions, 1, 1);
+ if (err < 0)
+ return err;
+
+ vk->GetPhysicalDeviceProperties(s->hwctx->phys_dev, &s->props);
+ vk->GetPhysicalDeviceMemoryProperties(s->hwctx->phys_dev, &s->mprops);
+
+ /* Default output parameters match input parameters. */
+ s->input_format = input_frames->sw_format;
+ if (s->output_format == AV_PIX_FMT_NONE)
+ s->output_format = input_frames->sw_format;
+ if (!s->output_width)
+ s->output_width = inlink->w;
+ if (!s->output_height)
+ s->output_height = inlink->h;
+
+ return 0;
+}
+
+int ff_vk_filter_config_output_inplace(AVFilterLink *outlink)
+{
+ int err;
+ AVFilterContext *avctx = outlink->src;
+ FFVulkanContext *s = avctx->priv;
+
+ av_buffer_unref(&outlink->hw_frames_ctx);
+
+ if (!s->device_ref) {
+ if (!avctx->hw_device_ctx) {
+ av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
+ "Vulkan device.\n");
+ return AVERROR(EINVAL);
+ }
+
+ err = vulkan_filter_set_device(avctx, avctx->hw_device_ctx);
+ if (err < 0)
+ return err;
+ }
+
+ outlink->hw_frames_ctx = av_buffer_ref(s->frames_ref);
+ if (!outlink->hw_frames_ctx)
+ return AVERROR(ENOMEM);
+
+ outlink->w = s->output_width;
+ outlink->h = s->output_height;
+
+ return 0;
+}
+
+int ff_vk_filter_config_output(AVFilterLink *outlink)
+{
+ int err;
+ AVFilterContext *avctx = outlink->src;
+ FFVulkanContext *s = avctx->priv;
+ AVBufferRef *output_frames_ref;
+ AVHWFramesContext *output_frames;
+
+ av_buffer_unref(&outlink->hw_frames_ctx);
+
+ if (!s->device_ref) {
+ if (!avctx->hw_device_ctx) {
+ av_log(avctx, AV_LOG_ERROR, "Vulkan filtering requires a "
+ "Vulkan device.\n");
+ return AVERROR(EINVAL);
+ }
+
+ err = vulkan_filter_set_device(avctx, avctx->hw_device_ctx);
+ if (err < 0)
+ return err;
+ }
+
+ output_frames_ref = av_hwframe_ctx_alloc(s->device_ref);
+ if (!output_frames_ref) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
+ output_frames = (AVHWFramesContext*)output_frames_ref->data;
+
+ output_frames->format = AV_PIX_FMT_VULKAN;
+ output_frames->sw_format = s->output_format;
+ output_frames->width = s->output_width;
+ output_frames->height = s->output_height;
+
+ err = av_hwframe_ctx_init(output_frames_ref);
+ if (err < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to initialise output "
+ "frames: %d.\n", err);
+ goto fail;
+ }
+
+ outlink->hw_frames_ctx = output_frames_ref;
+ outlink->w = s->output_width;
+ outlink->h = s->output_height;
+
+ return 0;
+fail:
+ av_buffer_unref(&output_frames_ref);
+ return err;
+}
+
+int ff_vk_filter_init(AVFilterContext *avctx)
+{
+ FFVulkanContext *s = avctx->priv;
+
+ s->output_format = AV_PIX_FMT_NONE;
+
+ return 0;
+}
diff --git a/libavfilter/vulkan_filter.h b/libavfilter/vulkan_filter.h
new file mode 100644
index 0000000000..bfdb9b2d7d
--- /dev/null
+++ b/libavfilter/vulkan_filter.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFILTER_VULKAN_FILTER_H
+#define AVFILTER_VULKAN_FILTER_H
+
+#include "avfilter.h"
+
+#include "vulkan.h"
+
+/**
+ * General lavfi IO functions
+ */
+int ff_vk_filter_init (AVFilterContext *avctx);
+int ff_vk_filter_config_input (AVFilterLink *inlink);
+int ff_vk_filter_config_output (AVFilterLink *outlink);
+int ff_vk_filter_config_output_inplace(AVFilterLink *outlink);
+
+#endif /* AVFILTER_VULKAN_FILTER_H */
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 22f9bf7eb6..3a70afe6a5 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -21,7 +21,7 @@
#include "vulkan.h"
#include "vulkan_loader.h"
-#if FF_VK_ENABLE_SHADER_COMPILATION && CONFIG_LIBGLSLANG
+#if CONFIG_LIBGLSLANG
#include "vulkan_glslang.c"
#endif
@@ -857,7 +857,7 @@ int ff_vk_compile_shader(FFVulkanContext *s, FFVkSPIRVShader *shd,
shd->shader.pName = entrypoint;
if (!s->spirv_compiler) {
-#if FF_VK_ENABLE_SHADER_COMPILATION && CONFIG_LIBGLSLANG
+#if CONFIG_LIBGLSLANG
s->spirv_compiler = ff_vk_glslang_init();
#else
return AVERROR(ENOSYS);
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index 3d89f02732..9706fd5ccb 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -22,15 +22,12 @@
#define VK_NO_PROTOTYPES
#define VK_ENABLE_BETA_EXTENSIONS
-#ifndef FF_VK_ENABLE_SHADER_COMPILATION
-#define FF_VK_ENABLE_SHADER_COMPILATION 1
-#endif
-
#include "pixdesc.h"
#include "bprint.h"
#include "hwcontext.h"
#include "hwcontext_vulkan.h"
#include "vulkan_functions.h"
+#include "vulkan_loader.h"
#define FF_VK_DEFAULT_USAGE_FLAGS (VK_IMAGE_USAGE_SAMPLED_BIT | \
VK_IMAGE_USAGE_STORAGE_BIT | \