[v2,19/37] meson: Automatically generate glsl_shaders.h from specified shader programs
diff mbox series

Message ID 20250824-b4-v0-5-2-gpuisp-v2-a-v2-19-96f4576c814e@linaro.org
State New
Headers show
Series
  • Add GLES 2.0 GPUISP to libcamera
Related show

Commit Message

Bryan O'Donoghue Aug. 24, 2025, 12:48 a.m. UTC
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.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/libcamera/internal/meson.build         | 10 ++++++++++
 include/libcamera/internal/shaders/meson.build | 10 ++++++++++
 utils/meson.build                              |  2 ++
 3 files changed, 22 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 5c80a28c4cbe6af5f0eef713eee995d61fa48a4b..90155857e44fc64803df5b5a054ad62e48b8e2f5 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -1,6 +1,7 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
 subdir('tracepoints')
+subdir('shaders')
 
 libcamera_internal_headers = files([
     'bayer_format.h',
@@ -58,5 +59,14 @@  tracepoints_h = custom_target(
 
 libcamera_internal_headers += tracepoints_h
 
+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
+
 subdir('converter')
 subdir('software_isp')
diff --git a/include/libcamera/internal/shaders/meson.build b/include/libcamera/internal/shaders/meson.build
new file mode 100644
index 0000000000000000000000000000000000000000..386b342d03b106e8303121ae9b84b2d2ee4e96d8
--- /dev/null
+++ b/include/libcamera/internal/shaders/meson.build
@@ -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',
+])
diff --git a/utils/meson.build b/utils/meson.build
index 95d657ac965fefc06ea2c0c445bd46b125e56564..3deed8ad4d7e6d18cd99d5d4302b19458e6b9f4b 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -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')