[libcamera-devel,RFC,1/2] qcam: viewfinder_gl: set the vertex shader file name in selectFormat()
diff mbox series

Message ID 20201109213411.30987-2-andrey.konovalov@linaro.org
State Changes Requested
Headers show
Series
  • qcam: viewfinder_gl: add RAW12P format support
Related show

Commit Message

Andrey Konovalov Nov. 9, 2020, 9:34 p.m. UTC
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@linaro.org>
---
 src/qcam/viewfinder_gl.cpp | 4 +++-
 src/qcam/viewfinder_gl.h   | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Dec. 8, 2020, 6:11 p.m. UTC | #1
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@linaro.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@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_;
>

Patch
diff mbox series

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_;