From patchwork Wed Dec 10 00:31:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25399 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3BBDEBD1F1 for ; Wed, 10 Dec 2025 00:32:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E586661431; Wed, 10 Dec 2025 01:32:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="eq2SQbn3"; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E1F7361418 for ; Wed, 10 Dec 2025 01:32:04 +0100 (CET) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7bc248dc16aso5237637b3a.0 for ; Tue, 09 Dec 2025 16:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765326723; x=1765931523; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pQX41AGsNI0QCoqx36ezoVqFb8YAenUUt7bw97cItvQ=; b=eq2SQbn3TbNT+Z318qnFRr2tynSPpImCD0C21cVlegguZaGj75SJQ4743T6Zne4Igs HeWZRVcsgXztpu9+X688y8LbdMKBF1vr7J6Hy2WF7Xw3YlhBxzuUogR9t7KChRxpIP8+ +GYX3nxRyJl5VaFyKu9LVHk63xwKbcdhX0BYbLAv2OfgGQf2WITBURDQIWfcm58H7cda ITjZ2sykvQxvmGPIX7R567veM+FiC/YZFIJJ7Bo2kaWCuFECsoufJvv5Ro4p0a3j45GV cfOhndLG3Cuvjh2ISBqG4MLRAE/V71cQhPO2hHMy51vGsR/sSaTIzsweHXqeNvjo0avC vC4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765326723; x=1765931523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pQX41AGsNI0QCoqx36ezoVqFb8YAenUUt7bw97cItvQ=; b=jDgO+Y72/La1bxUEK0du6B6iEjZo6K2QY2XJAGTSCNC7i9XhP5q0sAs4TwY0Xqoz3V 3KWt0S1g/GJRqAfPp78tCpLzAP7Qg3z/UYtBvDsf19IjgiqAvFDbFZ9aX6NL2qR7No1h Ft1/PBzOl5/J6SHTOj/sSTO+SJ2Q/gUEMWQwes/KAimh0EVm9McIjEvfvDTPPjp1UUvh sgCWsnGekvwHFu9GMDsW8i8zxgbRBFgV91MErFk+Rg5j0Qnjf57gfuJiRgzBJ7naaAQi 0w3eyDHt5vLnZFtb1wc2w9UNfRKwsjoMV6TOJcrxldFbNMBBlT0VE7B/pfs8arAH73bK hoRg== X-Gm-Message-State: AOJu0YyhGdG0nq58d9WXbIspypVD+QMN1GWixGW38kZUS43D/2uZzwsq 4DFCSnVFe59bYdXPDYCRF3dFDtBhOh3450PnJGITWZANaIKQ3kqPIPtqROD5B81TaD2DW+EUeu7 c2Ko6 X-Gm-Gg: ASbGnctLPSmklSgGsNRZbxv1Bu/9NyGs2baWDWBup9fz7/i+u++laR+//pPpFVP8ZNk xPx8JSuXkbIlPh4YwC3KCtUa9fOp+RB0vnqcNDkfkS42Tfxs5i0xB7tUjHAQZQOmDIUkHfFIT+p c473U04KiKax/KoIR0JxqwSqdau+P+h3ZiUAZJgiNx+g+GLC7hkIYX+k1o3wswn1gU6Nlw//ohy XKXiwPp/s4XtqJxriR/NeJkSTPLJSXWrkv/v8E+F75DBiqbcJ/8kAc2uzQIqfMwSGz82Qx5JQ60 FXSpMfzLkOxM0bCgaPGidrFKlBid7QFbnzPcokVE3mEmr2NJCWnZvZW+/IUJ8DFqB4uuDSkxjik 4UYnGgOB1VSOO4bcH1FzdUFP6iood8OL4qyLhjI6A+mpl+L9YCfmfBTv3w0OpojdAL3QoQcoZId 7cwvODVa3ixIVoaHZCAIDSY7wAryQWAp8rGkIBxRy7P947uPnEtItzFak5HnO3vSo1 X-Google-Smtp-Source: AGHT+IGqBDXNQUpVt5Ff8KdBg0FCL2vHzXfc9btu3an/SoSjVtOmnrl07d/UW/p9v7lnpyXqLoeNGQ== X-Received: by 2002:a05:6a20:3ca7:b0:342:873d:7e62 with SMTP id adf61e73a8af0-366e110193bmr448726637.29.1765326723080; Tue, 09 Dec 2025 16:32:03 -0800 (PST) Received: from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp. [150.147.107.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34a70427ea6sm566580a91.3.2025.12.09.16.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:32:02 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v4 03/20] meson: Automatically generate glsl_shaders.h from specified shader programs Date: Wed, 10 Dec 2025 00:31:20 +0000 Message-ID: <20251210003139.43606-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251210003139.43606-1-bryan.odonoghue@linaro.org> References: <20251210003139.43606-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- 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')