meson: Automatically generate glsl_shaders.h from specified shader programs

Encode the bayer shader files into a header as part of the build process.
Qcam already compiles the shader files down into a QT resource file which
it references internally.

In order to share the debayering shader programs outside of qcam create a
generic header which both qcam and libcamera can operate from.

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Bryan O'Donoghue
2025-12-11 23:22:28 +00:00
committed by Kieran Bingham
parent 19371dee41
commit ab675bc06b
3 changed files with 23 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ subdir('ipa')
subdir('pipeline')
subdir('proxy')
subdir('sensor')
subdir('shaders')
subdir('software_isp')
libdl = dependency('dl')
@@ -182,6 +183,16 @@ libcamera_deps += [
libyaml,
]
# Generate headers from shaders
libcamera_shader_headers = custom_target(
'gen-shader-headers',
input : [shader_files],
output : 'glsl_shaders.h',
command : [gen_shader_headers, meson.project_source_root(), meson.project_build_root(), '@OUTPUT@', '@INPUT@'],
)
libcamera_internal_headers += libcamera_shader_headers
# We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.
# The build_rpath is stripped at install time by meson, so we determine at
# runtime if the library is running from an installed location by checking

View File

@@ -0,0 +1,10 @@
# SPDX-License-Identifier: CC0-1.0
# List of shader files to convert to header hex
# for the purposes of inclusion in OpenGL debayering
shader_files = files([
'bayer_1x_packed.frag',
'bayer_8.frag',
'bayer_8.vert',
'identity.vert',
])

View File

@@ -3,5 +3,7 @@
subdir('codegen')
subdir('ipu3')
gen_shader_headers = files('gen-shader-headers.sh')
## Module signing
gen_ipa_priv_key = files('gen-ipa-priv-key.sh')