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.
This commit is contained in:
Lynne
2021-11-19 15:13:35 +01:00
parent e7f3279ba0
commit f6dd30df24
13 changed files with 240 additions and 200 deletions

View File

@@ -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);