[libcamera-devel] [PATCH][RFC 1/2] qcam: viewfinder_gl: set the vertex shader file name in selectFormat()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Dec 8 19:11:10 CET 2020
Hi Andrey,
Thank you for the patch.
On Tue, Nov 10, 2020 at 12:34:10AM +0300, Andrey Konovalov wrote:
> In preparation to extend the supported formats, make it possible
> to use different vertex fragment files depending on the format.
> Make "identity.vert" the default choice.
>
> Signed-off-by: Andrey Konovalov <andrey.konovalov at linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/qcam/viewfinder_gl.cpp | 4 +++-
> src/qcam/viewfinder_gl.h | 1 +
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
> index 5d9b442e..c74ce77b 100644
> --- a/src/qcam/viewfinder_gl.cpp
> +++ b/src/qcam/viewfinder_gl.cpp
> @@ -114,6 +114,8 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format)
> {
> bool ret = true;
>
> + vertexShaderFile_ = ":identity.vert";
> +
> fragmentShaderDefines_.clear();
>
> switch (format) {
> @@ -219,7 +221,7 @@ bool ViewFinderGL::createVertexShader()
> vertexShader_ = std::make_unique<QOpenGLShader>(QOpenGLShader::Vertex, this);
>
> /* Compile the vertex shader */
> - if (!vertexShader_->compileSourceFile(":identity.vert")) {
> + if (!vertexShader_->compileSourceFile(vertexShaderFile_)) {
> qWarning() << "[ViewFinderGL]:" << vertexShader_->log();
> return false;
> }
> diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h
> index 150fa4ae..6cf8f347 100644
> --- a/src/qcam/viewfinder_gl.h
> +++ b/src/qcam/viewfinder_gl.h
> @@ -72,6 +72,7 @@ private:
> QOpenGLShaderProgram shaderProgram_;
> std::unique_ptr<QOpenGLShader> vertexShader_;
> std::unique_ptr<QOpenGLShader> fragmentShader_;
> + QString vertexShaderFile_;
> QString fragmentShaderFile_;
> QStringList fragmentShaderDefines_;
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list