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 "vkupload.h"
#include "vkdownload.h"
#include "vkdeviceprovider.h"
#include "gstvulkanelements.h"
#if defined(HAVE_GLSLC)
#include "vkimageidentity.h"
#include "vkcolorconvert.h"
#include "vkshaderspv.h"
#include "vkdownload.h"
#include "vkviewconvert.h"
#include "vkdeviceprovider.h"
#include "gstvulkanelements.h"
#include "vkoverlaycompositor.h"
#endif
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
#include "vkh264dec.h"
@ -57,7 +60,7 @@ plugin_init (GstPlugin * plugin)
ret |= GST_ELEMENT_REGISTER (vulkanupload, plugin);
ret |= GST_ELEMENT_REGISTER (vulkandownload, plugin);
#if defined(HAVE_GLSLC)
ret |= GST_ELEMENT_REGISTER (vulkancolorconvert, 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 (vulkanoverlaycompositor, plugin);
#endif
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
GST_ELEMENT_REGISTER (vulkanh264dec, plugin);
GST_ELEMENT_REGISTER (vulkanh265dec, plugin);

View file

@ -10,42 +10,53 @@ if not gstvulkan_dep.found()
endif
endif
# Should already have checked for this
assert(glslc.found(), 'Expected glslc to be available')
subdir('shaders')
extra_deps = []
extra_args = []
vulkan_sources = files(
'gstvulkan.c',
'gstvulkanelement.c',
'vkcolorconvert.c',
'vkdownload.c',
'vkdeviceprovider.c',
'vkimageidentity.c',
'vkshaderspv.c',
'vksink.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',
'vkoverlaycompositor.c',
)
vulkan_plugin_enum_headers = files(
'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
vulkan_sources += files('vkh264dec.c', 'vkh265dec.c')
extra_deps += gstcodecs_dep
extra_args += ['-DGST_USE_UNSTABLE_API']
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',
vulkan_sources, vulkan_compiled_shader_sources, vulkan_plugin_enums,
c_args : gst_plugins_bad_args + extra_args,

View file

@ -298,11 +298,7 @@ if not vulkan_windowing
endif
endif
# Only needed for the vulkan plugin, but doesn't make sense to build
# 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 not vulkan_dep.found() or not has_vulkan_header
if get_option('vulkan').enabled()
error('GStreamer Vulkan integration required via options, but needed dependencies not found.')
else