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

Kunal Agarwal kunalagarwal1072002 at gmail.com
Fri Jul 22 09:30:21 CEST 2022


Hi Laurent,

Thank you for the pointers.

> 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 ?

Tested the working of vertex shader without explicitly specifying precision.
It works. Other than the limitations of highp for some devices, I don't see
any particular reason to reduce the precision of floats to mediump.
So default highp should be fine and this patch need not be applied.

Regards,

Kunal Agarwal


On Fri, Jul 22, 2022 at 1:45 AM Laurent Pinchart
<laurent.pinchart at ideasonboard.com> wrote:
>
> 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