qcam: viewfinder_gl: Change uniform float tex_stepx to vec2 tex_step

In preparation to extend the supported formats, extend the tex_stepx
uniform to cover the steps between texels in both horizontal and
vertical directions.

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>
This commit is contained in:
Andrey Konovalov
2021-06-22 16:46:44 +03:00
committed by Laurent Pinchart
parent 12809ff171
commit fa52c0f22f
3 changed files with 9 additions and 8 deletions
+4 -3
View File
@@ -289,7 +289,7 @@ bool ViewFinderGL::createFragmentShader()
textureUniformY_ = shaderProgram_.uniformLocation("tex_y");
textureUniformU_ = shaderProgram_.uniformLocation("tex_u");
textureUniformV_ = shaderProgram_.uniformLocation("tex_v");
textureUniformStepX_ = shaderProgram_.uniformLocation("tex_stepx");
textureUniformStep_ = shaderProgram_.uniformLocation("tex_step");
/* Create the textures. */
for (std::unique_ptr<QOpenGLTexture> &texture : textures_) {
@@ -508,8 +508,9 @@ void ViewFinderGL::doRender()
* ([0, 1]). There are exactly width - 1 steps between the
* leftmost and rightmost texels.
*/
shaderProgram_.setUniformValue(textureUniformStepX_,
1.0f / (size_.width() / 2 - 1));
shaderProgram_.setUniformValue(textureUniformStep_,
1.0f / (size_.width() / 2 - 1),
1.0f /* not used */);
break;
case libcamera::formats::ABGR8888: