[{"id":37198,"web_url":"https://patchwork.libcamera.org/comment/37198/","msgid":"<85v7in1ppz.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-12-03T16:42:48","subject":"Re: [PATCH v6 05/24] libcamera: shaders: Use highp not mediump for\n\tfloat precision","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> mediump gives 10 bits of mantissa as the resolution. At higher resolutions\n> 10 bits of accuracy is insufficient - for example at a width of 1928 bytes\n> we need log2(1928) = ~11 bit resolution.\n>\n> Switching to highp gives us 23 bits of mantissa giving a sample width\n> precision of about 2^23 ~ 8,388,608.\n>\n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/shaders/RGB.frag             | 2 +-\n>  src/libcamera/shaders/YUV_2_planes.frag    | 2 +-\n>  src/libcamera/shaders/YUV_3_planes.frag    | 2 +-\n>  src/libcamera/shaders/YUV_packed.frag      | 2 +-\n>  src/libcamera/shaders/bayer_1x_packed.frag | 2 +-\n>  src/libcamera/shaders/bayer_unpacked.frag  | 2 +-\n>  6 files changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/libcamera/shaders/RGB.frag b/src/libcamera/shaders/RGB.frag\n> index 4c374ac98..724395894 100644\n> --- a/src/libcamera/shaders/RGB.frag\n> +++ b/src/libcamera/shaders/RGB.frag\n> @@ -6,7 +6,7 @@\n>   */\n>  \n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  varying vec2 textureOut;\n> diff --git a/src/libcamera/shaders/YUV_2_planes.frag b/src/libcamera/shaders/YUV_2_planes.frag\n> index 1d5d12062..d286f1179 100644\n> --- a/src/libcamera/shaders/YUV_2_planes.frag\n> +++ b/src/libcamera/shaders/YUV_2_planes.frag\n> @@ -6,7 +6,7 @@\n>   */\n>  \n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  varying vec2 textureOut;\n> diff --git a/src/libcamera/shaders/YUV_3_planes.frag b/src/libcamera/shaders/YUV_3_planes.frag\n> index 8f788e90a..8e3e0b4a5 100644\n> --- a/src/libcamera/shaders/YUV_3_planes.frag\n> +++ b/src/libcamera/shaders/YUV_3_planes.frag\n> @@ -6,7 +6,7 @@\n>   */\n>  \n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  varying vec2 textureOut;\n> diff --git a/src/libcamera/shaders/YUV_packed.frag b/src/libcamera/shaders/YUV_packed.frag\n> index b9ef9d41b..3c9e3e397 100644\n> --- a/src/libcamera/shaders/YUV_packed.frag\n> +++ b/src/libcamera/shaders/YUV_packed.frag\n> @@ -6,7 +6,7 @@\n>   */\n>  \n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  varying vec2 textureOut;\n> diff --git a/src/libcamera/shaders/bayer_1x_packed.frag b/src/libcamera/shaders/bayer_1x_packed.frag\n> index f53f55758..19b13ad08 100644\n> --- a/src/libcamera/shaders/bayer_1x_packed.frag\n> +++ b/src/libcamera/shaders/bayer_1x_packed.frag\n> @@ -20,7 +20,7 @@\n>   */\n>  \n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  /*\n> diff --git a/src/libcamera/shaders/bayer_unpacked.frag b/src/libcamera/shaders/bayer_unpacked.frag\n> index 7e35ca88e..aa7a1b004 100644\n> --- a/src/libcamera/shaders/bayer_unpacked.frag\n> +++ b/src/libcamera/shaders/bayer_unpacked.frag\n> @@ -16,7 +16,7 @@ Copyright (C) 2021, Linaro\n>  \n>  //Pixel Shader\n>  #ifdef GL_ES\n> -precision mediump float;\n> +precision highp float;\n>  #endif\n>  \n>  /** Monochrome RGBA or GL_LUMINANCE Bayer encoded texture.*/","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 D257BBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 16:42:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 325BB60F78;\n\tWed,  3 Dec 2025 17:42:59 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7CA02609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 17:42:57 +0100 (CET)","from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-108-3yhC9vruPCKhWhQwx4wtwg-1; Wed, 03 Dec 2025 11:42:51 -0500","by mail-wm1-f69.google.com with SMTP id\n\t5b1f17b1804b1-477964c22e0so30285e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Dec 2025 08:42:51 -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\t5b1f17b1804b1-4792b02e84dsm20160995e9.4.2025.12.03.08.42.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Dec 2025 08:42:49 -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=\"XWxm33Ro\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1764780176;\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=JrJEQV+vxoCvqVrjGml6QSs5zOtGfxOiDxtuzcY90do=;\n\tb=XWxm33RoEziVjULSmKuAmlEQhnbhCyirLZzVyAtzQ4e8ONerxQhwqbaLE7JsfEqIb+W0/L\n\tKkXzIxXcXToQsF1P8A2l+y14dqo5v7ypeooRogbhi5s/5fywSCtOKyKeZkBMvf2qb1Ycda\n\tsFHvHEkGSxg2rTM8GW6Nb+4xuVEnNAo=","X-MC-Unique":"3yhC9vruPCKhWhQwx4wtwg-1","X-Mimecast-MFC-AGG-ID":"3yhC9vruPCKhWhQwx4wtwg_1764780171","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764780170; x=1765384970;\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=JrJEQV+vxoCvqVrjGml6QSs5zOtGfxOiDxtuzcY90do=;\n\tb=l9vyoFZSb5PxKDYf0tiIadzOJ8aFcI9A7p1rmafU3bAdM6YoHX1XSaK9kIzCGunSBY\n\t6nL/Dw7+a+1+5X8tHUsMDPqmm394o8XnWIWr5wBNMhNzdJwJCM5O27illIKjEOoQMIaa\n\tF9yqxmFOWqgeElOV7893NC08I0CJoeJUS5vNRhAUOcywshHFPNGTBJmMlF8ADYVD9nmh\n\totywwBwkkgMFutnFVRNe8uS59iLZSCEyUQm/WXLxgGwMr7BdW94fxpslr4WoooaLVNGd\n\t1MmFax+77qMkSNO8m+/Q+D+giVTsc+2039S5L1y/+DEBhHplVRsV0EvIPzm1yl+uADVf\n\tMYKg==","X-Gm-Message-State":"AOJu0YyNeFTGYwUwS8bDje1UqoPKkEmeq7cpguypLEIhp13tHNBhc63b\n\t62KVfnzoaIvkR8WDcaG9aV1570B0Xgdu+wTW+ust+uhvHpTibL8QLgEqCk5yjcfSY0cf1MT1G/H\n\tl/2y2UJezIt6RF1IXUXUxPnK92fN63/nMgCFBF19VoNqwfqWbZ2PKIag+2PqSjkM0zU0kcIplmu\n\tc=","X-Gm-Gg":"ASbGncuIjnNs9Sc30arMgAwiIP0qvcoP+1VLUDnNgp3LbX3VJraZ21JFTwEybYqQz/r\n\tWQdfcN42pa189CVGb4KBGtrU+rqkklJhT7ifRLLbOTGcAtEvAajxM2QFcENr+EQR+rjpOyUUI2t\n\tNWm5tcDIdmQBIhkM1sMVicfOGBmWU2/ozA2n7XYBBKtk0021gSyFf33DGcSbnLslB5Yh/KSToes\n\twp7bwRhIc2d+vwy1XMoweK6+9O4g5Ld/qHflEewAQxeqOdYILIkzUXLKwERTj42HvRGiBFeEMZ7\n\tRpZVqHZwEdb427aihM7RFUV6QkWaO3Abp+1S5q1QNNToOrjNlKV/Vq7HzphC9d2n7OnIKyTRQYn\n\tqcGNKw80L7gVmW6ldfV2cIh2jRZaVWWUdsX3cZPZwWJA12w1RqzZlViPvxGbjang=","X-Received":["by 2002:a05:600c:45c6:b0:479:13e9:3d64 with SMTP id\n\t5b1f17b1804b1-4792eb4caf3mr586345e9.15.1764780170469; \n\tWed, 03 Dec 2025 08:42:50 -0800 (PST)","by 2002:a05:600c:45c6:b0:479:13e9:3d64 with SMTP id\n\t5b1f17b1804b1-4792eb4caf3mr586115e9.15.1764780170065; \n\tWed, 03 Dec 2025 08:42:50 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IEVPFseW6xcFIHMQrpZ1E2MDcfDsURt3hM5CJ6deyvNxcFaNwMC5GP13Fpw2FB52RPJzGiY8g==","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 v6 05/24] libcamera: shaders: Use highp not mediump for\n\tfloat precision","In-Reply-To":"<20251202134544.662446-6-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Tue, 2 Dec 2025 13:45:25 +0000\")","References":"<20251202134544.662446-1-bryan.odonoghue@linaro.org>\n\t<20251202134544.662446-6-bryan.odonoghue@linaro.org>","Date":"Wed, 03 Dec 2025 17:42:48 +0100","Message-ID":"<85v7in1ppz.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":"VPCEaBLpbE8yF3j1XPfmDLEYSLyQKquyQVezUim-ToE_1764780171","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>"}}]