From a3b1539869ae53a6446a1c31bdade6560f91a46b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 6 Sep 2021 23:22:54 +0300 Subject: qcam: viewfinder_gl: Support configurable stride in shaders The RGB and YUV conversion doesn't take the stride into account, neither when creating the textures, nor when sampling them. Fix it by using the stride as the texture width, and multiplying the x coordinate in the vertex shaders by a factor to only sample the active portion of the image. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/qcam/assets/shader/identity.vert | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/qcam/assets/shader/identity.vert') diff --git a/src/qcam/assets/shader/identity.vert b/src/qcam/assets/shader/identity.vert index 6d6f7551..12c41377 100644 --- a/src/qcam/assets/shader/identity.vert +++ b/src/qcam/assets/shader/identity.vert @@ -9,8 +9,10 @@ attribute vec4 vertexIn; attribute vec2 textureIn; varying vec2 textureOut; +uniform float stride_factor; + void main(void) { gl_Position = vertexIn; - textureOut = textureIn; + textureOut = vec2(textureIn.x * stride_factor, textureIn.y); } -- cgit v1.2.1