vulkan: support not having glslc available for building vulkan plugin

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6980>
This commit is contained in:
Matthew Waters 2024-06-01 21:35:26 +10:00 committed by GStreamer Marge Bot
parent 9b60b32cf8
commit 346df4cb3f
3 changed files with 39 additions and 29 deletions

View file

@ -31,14 +31,17 @@
#include "vksink.h" #include "vksink.h"
#include "vkupload.h" #include "vkupload.h"
#include "vkdownload.h"
#include "vkdeviceprovider.h"
#include "gstvulkanelements.h"
#if defined(HAVE_GLSLC)
#include "vkimageidentity.h" #include "vkimageidentity.h"
#include "vkcolorconvert.h" #include "vkcolorconvert.h"
#include "vkshaderspv.h" #include "vkshaderspv.h"
#include "vkdownload.h"
#include "vkviewconvert.h" #include "vkviewconvert.h"
#include "vkdeviceprovider.h"
#include "gstvulkanelements.h"
#include "vkoverlaycompositor.h" #include "vkoverlaycompositor.h"
#endif
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
#include "vkh264dec.h" #include "vkh264dec.h"
@ -57,7 +60,7 @@ plugin_init (GstPlugin * plugin)
ret |= GST_ELEMENT_REGISTER (vulkanupload, plugin); ret |= GST_ELEMENT_REGISTER (vulkanupload, plugin);
ret |= GST_ELEMENT_REGISTER (vulkandownload, plugin); ret |= GST_ELEMENT_REGISTER (vulkandownload, plugin);
#if defined(HAVE_GLSLC)
ret |= GST_ELEMENT_REGISTER (vulkancolorconvert, plugin); ret |= GST_ELEMENT_REGISTER (vulkancolorconvert, plugin);
ret |= GST_ELEMENT_REGISTER (vulkanimageidentity, plugin); ret |= GST_ELEMENT_REGISTER (vulkanimageidentity, plugin);
@ -67,7 +70,7 @@ plugin_init (GstPlugin * plugin)
ret |= GST_ELEMENT_REGISTER (vulkanviewconvert, plugin); ret |= GST_ELEMENT_REGISTER (vulkanviewconvert, plugin);
ret |= GST_ELEMENT_REGISTER (vulkanoverlaycompositor, plugin); ret |= GST_ELEMENT_REGISTER (vulkanoverlaycompositor, plugin);
#endif
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
GST_ELEMENT_REGISTER (vulkanh264dec, plugin); GST_ELEMENT_REGISTER (vulkanh264dec, plugin);
GST_ELEMENT_REGISTER (vulkanh265dec, plugin); GST_ELEMENT_REGISTER (vulkanh265dec, plugin);

View file

@ -10,42 +10,53 @@ if not gstvulkan_dep.found()
endif endif
endif endif
# Should already have checked for this extra_deps = []
assert(glslc.found(), 'Expected glslc to be available') extra_args = []
subdir('shaders')
vulkan_sources = files( vulkan_sources = files(
'gstvulkan.c', 'gstvulkan.c',
'gstvulkanelement.c', 'gstvulkanelement.c',
'vkcolorconvert.c',
'vkdownload.c', 'vkdownload.c',
'vkdeviceprovider.c', 'vkdeviceprovider.c',
'vkimageidentity.c',
'vkshaderspv.c',
'vksink.c', 'vksink.c',
'vkupload.c', 'vkupload.c',
)
vulkan_plugin_enums = []
glslc = find_program('glslc', required: get_option('vulkan'))
if not glslc.found()
if get_option('vulkan').enabled()
error('GStreamer Vulkan plugin required via options, but glslc was not found.')
else
subdir_done()
endif
vulkan_compiled_shader_sources = []
else
extra_args += ['-DHAVE_GLSLC']
subdir('shaders')
vulkan_sources += files(
'vkcolorconvert.c',
'vkimageidentity.c',
'vkshaderspv.c',
'vkviewconvert.c', 'vkviewconvert.c',
'vkoverlaycompositor.c', 'vkoverlaycompositor.c',
) )
vulkan_plugin_enum_headers = files( vulkan_plugin_enum_headers = files(
'vkviewconvert.h', 'vkviewconvert.h',
) )
vulkan_plugin_enums += gnome.mkenums_simple('gstvulkan-plugins-enumtypes',
sources : vulkan_plugin_enum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/gst.h>')
endif
extra_deps = []
extra_args = []
if vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') == 1 if vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') == 1
vulkan_sources += files('vkh264dec.c', 'vkh265dec.c') vulkan_sources += files('vkh264dec.c', 'vkh265dec.c')
extra_deps += gstcodecs_dep extra_deps += gstcodecs_dep
extra_args += ['-DGST_USE_UNSTABLE_API'] extra_args += ['-DGST_USE_UNSTABLE_API']
endif endif
vulkan_plugin_enums = gnome.mkenums_simple('gstvulkan-plugins-enumtypes',
sources : vulkan_plugin_enum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/gst.h>')
gstvulkan_plugin = library('gstvulkan', gstvulkan_plugin = library('gstvulkan',
vulkan_sources, vulkan_compiled_shader_sources, vulkan_plugin_enums, vulkan_sources, vulkan_compiled_shader_sources, vulkan_plugin_enums,
c_args : gst_plugins_bad_args + extra_args, c_args : gst_plugins_bad_args + extra_args,

View file

@ -298,11 +298,7 @@ if not vulkan_windowing
endif endif
endif endif
# Only needed for the vulkan plugin, but doesn't make sense to build if not vulkan_dep.found() or not has_vulkan_header
# anything else vulkan related if we are not going to build the plugin
glslc = find_program('glslc', required: get_option('vulkan'))
if not vulkan_dep.found() or not has_vulkan_header or not glslc.found()
if get_option('vulkan').enabled() if get_option('vulkan').enabled()
error('GStreamer Vulkan integration required via options, but needed dependencies not found.') error('GStreamer Vulkan integration required via options, but needed dependencies not found.')
else else