[libcamera-devel] [PATCH v2 2/2] qcam: assets: shader: bayer_8.vert: Add precision

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jul 21 22:15:03 CEST 2022


Hi Kunal,

Thank you for the patch.

On Wed, Jun 29, 2022 at 12:43:55AM +0530, Kunal Agarwal via libcamera-devel wrote:
> Currently there is no defined precision for data types
> which results in compilation errors for shader.
> 
> Adding precision mediump for sufficient and required
> range and accuracy. Also suitable for textures.
> Precision highp also works but is not supported by some
> older hardware devices and consumes more memory.

The OpenGL ES Shading Language specification states, in section "4.5.3
Default Precision Qualifiers",

  The vertex language has the following predeclared globally scoped
  default precision statements:

  precision highp float;
  precision highp int;
  precision lowp sampler2D;
  precision lowp samplerCube;

Do you get any shader compilation error without this patch ? If so, on
which platform ? If not, do you need to reduce the precision for floats
to mediump, or is the default highp fine ?

> Signed-off-by: Kunal Agarwal <kunalagarwal1072002 at gmail.com>
> ---
>  src/qcam/assets/shader/bayer_8.vert | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/qcam/assets/shader/bayer_8.vert b/src/qcam/assets/shader/bayer_8.vert
> index 3695a5e9..a250bb81 100644
> --- a/src/qcam/assets/shader/bayer_8.vert
> +++ b/src/qcam/assets/shader/bayer_8.vert
> @@ -15,6 +15,9 @@ Copyright (C) 2021, Linaro
>  */
>  
>  //Vertex Shader
> +#ifdef GL_ES
> +precision mediump float;
> +#endif
>  
>  attribute vec4 vertexIn;
>  attribute vec2 textureIn;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list