summaryrefslogtreecommitdiff
path: root/src/qcam/assets
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-06 23:22:54 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-22 11:21:49 +0300
commita3b1539869ae53a6446a1c31bdade6560f91a46b (patch)
tree72e66a1f4f06583279ce0f9a012f0512946579d2 /src/qcam/assets
parent5e1b7a0f6845add01a6d7842ca34f9fbb0712810 (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/qcam/assets')
-rw-r--r--src/qcam/assets/shader/identity.vert4
1 files changed, 3 insertions, 1 deletions
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);
}