[{"id":37183,"web_url":"https://patchwork.libcamera.org/comment/37183/","msgid":"<85bjkf4rlz.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-12-03T13:33:44","subject":"Re: [PATCH v3 03/22] meson: Automatically generate glsl_shaders.h\n\tfrom specified shader programs","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> Encode the bayer shader files into a header as part of the build process.\n> Qcam already compiles the shader files down into a QT resource file which\n> it references internally.\n>\n> In order to share the debayering shader programs outside of qcam create a\n> generic header which both qcam and libcamera can operate from.\n>\n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n\nI'm not a meson expert but the patch looks plausible and building\nlibcamera with this works fine for me.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/meson.build         | 11 +++++++++++\n>  src/libcamera/shaders/meson.build | 10 ++++++++++\n>  utils/meson.build                 |  2 ++\n>  3 files changed, 23 insertions(+)\n>  create mode 100644 src/libcamera/shaders/meson.build\n>\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 34e20f557..90d434a5a 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -76,6 +76,7 @@ subdir('ipa')\n>  subdir('pipeline')\n>  subdir('proxy')\n>  subdir('sensor')\n> +subdir('shaders')\n>  subdir('software_isp')\n>  \n>  libdl = dependency('dl')\n> @@ -182,6 +183,16 @@ libcamera_deps += [\n>      libyaml,\n>  ]\n>  \n> +# Generate headers from shaders\n> +libcamera_shader_headers = custom_target(\n> +    'gen-shader-headers',\n> +    input : [shader_files],\n> +    output : 'glsl_shaders.h',\n> +    command : [gen_shader_headers, meson.project_source_root(), meson.project_build_root(), '@OUTPUT@', '@INPUT@'],\n> +)\n> +\n> +libcamera_internal_headers += libcamera_shader_headers\n> +\n>  # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.\n>  # The build_rpath is stripped at install time by meson, so we determine at\n>  # runtime if the library is running from an installed location by checking\n> diff --git a/src/libcamera/shaders/meson.build b/src/libcamera/shaders/meson.build\n> new file mode 100644\n> index 000000000..386b342d0\n> --- /dev/null\n> +++ b/src/libcamera/shaders/meson.build\n> @@ -0,0 +1,10 @@\n> +# SPDX-License-Identifier: CC0-1.0\n> +\n> +# List of shader files to convert to header hex\n> +# for the purposes of inclusion in OpenGL debayering\n> +shader_files = files([\n> +    'bayer_1x_packed.frag',\n> +    'bayer_8.frag',\n> +    'bayer_8.vert',\n> +    'identity.vert',\n> +])\n> diff --git a/utils/meson.build b/utils/meson.build\n> index 95d657ac9..3deed8ad4 100644\n> --- a/utils/meson.build\n> +++ b/utils/meson.build\n> @@ -3,5 +3,7 @@\n>  subdir('codegen')\n>  subdir('ipu3')\n>  \n> +gen_shader_headers = files('gen-shader-headers.sh')\n> +\n>  ## Module signing\n>  gen_ipa_priv_key = files('gen-ipa-priv-key.sh')","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AE40FC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 13:33:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 59D9E60F4E;\n\tWed,  3 Dec 2025 14:33:52 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 810FF609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 14:33:50 +0100 (CET)","from mail-wr1-f69.google.com (mail-wr1-f69.google.com\n\t[209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-53-sQjEwDbvMyulARDgHxo4BQ-1; Wed, 03 Dec 2025 08:33:48 -0500","by mail-wr1-f69.google.com with SMTP id\n\tffacd0b85a97d-42e2973a812so627400f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Dec 2025 05:33:47 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42e1ca4078csm38676752f8f.29.2025.12.03.05.33.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Dec 2025 05:33:45 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"UJijDnR8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1764768829;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=toEkqYs7s2MpqM4+TZ3l+HjF6/LQ/QfVCmML0Dcfv0o=;\n\tb=UJijDnR8lSo8wU2uWe8VNhcVMIfGGxztVv1fTcD8h2I7YuJNNeLNW6jVE31xYBRaDDBRK5\n\tmmEPIOlYrB0tPeU63/RnQEij3vh73Wx9V1VQqdT56Un3wk2tgahYqO4fB9BiR5p+LUfPvo\n\tQECZK6+ggETUI/NqHtWO6TrjNKkp18w=","X-MC-Unique":"sQjEwDbvMyulARDgHxo4BQ-1","X-Mimecast-MFC-AGG-ID":"sQjEwDbvMyulARDgHxo4BQ_1764768827","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764768826; x=1765373626;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=toEkqYs7s2MpqM4+TZ3l+HjF6/LQ/QfVCmML0Dcfv0o=;\n\tb=m9BOcwKNIUQ3F+7fY10go2ng/BDHQRtMMlYM7pl//MtKWVXpZSyqAzgVG3+0IBbzzr\n\tYvgSDl/VY/LY1zv8tX8M+r+z5jGhGlaOrepJ7mS3DMQoUsfL/ufhAKvh+t8atLiyProh\n\tcJX7rPYTUkAMTt+f/+WZSx2l1cSeTyw3A3yuPdDvKpTvBrxWU7F0mbf0/qCKRxILfDIy\n\ttIJcZDR+qtgTHh3xbBnLV887mdEN2WBu9MKBON1CrgtX/k0rQt2Tw8SASmOs/DAKWFR7\n\t2M58rZWPzkRH7Ssy64iGB6qzTuHXWt4c4ROw/lofQ30lcQ4iVOJLO+KlHEuGDsr6l1Bf\n\tc4CA==","X-Gm-Message-State":"AOJu0YyCuqgSMkbUcmb68kLxoq2UPmnM4Z+yMf6jTLEsfWYYujpcXYZy\n\tElYA0H1gVJmCqjvNqyOimQfYuntWqp/WJaEu4gJ6ESAZBa42l4BbJ9iDB1o4T/X9BhZlUKWA/Vp\n\tmpmCMcWIySw1T1UUn0QyyBkMMrLuN5FuJFsx4q4535FSUNkW3RJX9Pu3lzadw4ciTh3rsGoH2xq\n\tHFmiaH8Nc=","X-Gm-Gg":"ASbGncs8DmqbqBsqgZ9UJSc3QsOG3J3k9zAdjnqgk7b0FqGeXJ/IvMv9XQ65GxLBHH/\n\t4ufoNmvzhiGAM1OAa5cJMD04UJjGZU845lGD+RTPS4lWwulEFQfjFX7ASiW6nEsHwc18e9ZWqRU\n\tWvGWMMqMC1P5YOSpNXgqXa2vwigExwwTMNxNAJE6K3pJF7Nqvy3e0mbJW/GBXxtpoBcFfmyCPn2\n\tlRqJm7nTytkZKiFqrvupT6GZVijGqC0/Zs6/LrNpSlRAmAzz8SMMmsbSTtuqftVUhRI1Dhp6fJK\n\t85esyYID6DJymccwHStyTP1HnF5vE9YAo8Vdh7iRlSas36wG4pzg3CXswOplhUy/zmi4BDHnjCF\n\tVAu0PSzWcgl26/2F+nXqpKL64o46CPFHeuvp7pPAoaCyoYs40UuswcvTjJskuLw8=","X-Received":["by 2002:a05:6000:40cf:b0:429:bfbb:5dae with SMTP id\n\tffacd0b85a97d-42f6d5a0f65mr7567930f8f.17.1764768826323; \n\tWed, 03 Dec 2025 05:33:46 -0800 (PST)","by 2002:a05:6000:40cf:b0:429:bfbb:5dae with SMTP id\n\tffacd0b85a97d-42f6d5a0f65mr7567906f8f.17.1764768825922; \n\tWed, 03 Dec 2025 05:33:45 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IEOUiYI8G3bPdWXemL248L4zuDFzum8NZGidPjGXdgZ3h41EMNay9jhWg2xSMzI1//xsbNx6Q==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  pavel@ucw.cz,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v3 03/22] meson: Automatically generate glsl_shaders.h\n\tfrom specified shader programs","In-Reply-To":"<20251202133157.661407-4-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Tue, 2 Dec 2025 13:31:34 +0000\")","References":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>\n\t<20251202133157.661407-4-bryan.odonoghue@linaro.org>","Date":"Wed, 03 Dec 2025 14:33:44 +0100","Message-ID":"<85bjkf4rlz.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"uLLVCOgZ0rHhgv1c6PZ634Ii54RiVTsyMMZwUbRlN8U_1764768827","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]