| Message ID | 20251202133157.661407-4-bryan.odonoghue@linaro.org |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > 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> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> I'm not a meson expert but the patch looks plausible and building libcamera with this works fine for me. Reviewed-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/libcamera/meson.build | 11 +++++++++++ > src/libcamera/shaders/meson.build | 10 ++++++++++ > utils/meson.build | 2 ++ > 3 files changed, 23 insertions(+) > create mode 100644 src/libcamera/shaders/meson.build > > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > index 34e20f557..90d434a5a 100644 > --- a/src/libcamera/meson.build > +++ b/src/libcamera/meson.build > @@ -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 > diff --git a/src/libcamera/shaders/meson.build b/src/libcamera/shaders/meson.build > new file mode 100644 > index 000000000..386b342d0 > --- /dev/null > +++ b/src/libcamera/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 95d657ac9..3deed8ad4 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')
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 34e20f557..90d434a5a 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -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 diff --git a/src/libcamera/shaders/meson.build b/src/libcamera/shaders/meson.build new file mode 100644 index 000000000..386b342d0 --- /dev/null +++ b/src/libcamera/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 95d657ac9..3deed8ad4 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')