diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2021-06-22 16:46:51 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-06-30 04:09:10 +0300 |
commit | 43fd7d0fc84035793639d6f432f621dba3c64ef8 (patch) | |
tree | 0082cba2630cff93f8de534335d6e07b37c42868 /src/qcam/assets/shader/bayer_8.vert | |
parent | e4be72d0ca1099173869e4aa1b9604773dcae7b8 (diff) |
qcam: viewfinder_gl: Add support for RAW8 Bayer formats
This integrates the vertex and the fragment shaders by Morgan McGuire
into qcam.
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/assets/shader/bayer_8.vert')
-rw-r--r-- | src/qcam/assets/shader/bayer_8.vert | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/qcam/assets/shader/bayer_8.vert b/src/qcam/assets/shader/bayer_8.vert index 347c15f7..3695a5e9 100644 --- a/src/qcam/assets/shader/bayer_8.vert +++ b/src/qcam/assets/shader/bayer_8.vert @@ -9,17 +9,22 @@ Morgan McGuire This paper appears in issue Volume 13, Number 4. --------------------------------------------------------- Copyright (c) 2008, Morgan McGuire. All rights reserved. + +Modified by Linaro Ltd to integrate it into libcamera. +Copyright (C) 2021, Linaro */ //Vertex Shader +attribute vec4 vertexIn; +attribute vec2 textureIn; -/** (w,h,1/w,1/h) */ -uniform vec4 sourceSize; +uniform vec2 tex_size; /* The texture size in pixels */ +uniform vec2 tex_step; /** Pixel position of the first red pixel in the */ /** Bayer pattern. [{0,1}, {0, 1}]*/ -uniform vec2 firstRed; +uniform vec2 tex_bayer_first_red; /** .xy = Pixel being sampled in the fragment shader on the range [0, 1] .zw = ...on the range [0, sourceSize], offset by firstRed */ @@ -34,14 +39,13 @@ varying vec4 xCoord; varying vec4 yCoord; void main(void) { - center.xy = gl_MultiTexCoord0.xy; - center.zw = gl_MultiTexCoord0.xy * sourceSize.xy + firstRed; + center.xy = textureIn; + center.zw = textureIn * tex_size + tex_bayer_first_red; - vec2 invSize = sourceSize.zw; - xCoord = center.x + vec4(-2.0 * invSize.x, - -invSize.x, invSize.x, 2.0 * invSize.x); - yCoord = center.y + vec4(-2.0 * invSize.y, - -invSize.y, invSize.y, 2.0 * invSize.y); + xCoord = center.x + vec4(-2.0 * tex_step.x, + -tex_step.x, tex_step.x, 2.0 * tex_step.x); + yCoord = center.y + vec4(-2.0 * tex_step.y, + -tex_step.y, tex_step.y, 2.0 * tex_step.y); - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = vertexIn; } |