[libcamera-devel] [PATCH 4/7] qcam: viewfinder_gl: Rename shader files
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Sep 16 16:52:51 CEST 2020
Rename shader files to prepare for packed YUYV support:
- The NV prefix isn't a good match for packed (or for 3-planar) formats,
replace it with a YUV prefix
- Use .frag and .vert extensions to differentiate between fragment and
vertex shaders
While at it, remove the uneeded './' file name prefix in shaders.qrc.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
.../shader/{NV_vertex_shader.glsl => YUV.vert} | 2 +-
...2_planes_UV_f.glsl => YUV_2_planes_UV.frag} | 2 +-
...2_planes_VU_f.glsl => YUV_2_planes_VU.frag} | 2 +-
.../{NV_3_planes_f.glsl => YUV_3_planes.frag} | 2 +-
src/qcam/assets/shader/shaders.qrc | 8 ++++----
src/qcam/viewfinder_gl.cpp | 18 +++++++++---------
6 files changed, 17 insertions(+), 17 deletions(-)
rename src/qcam/assets/shader/{NV_vertex_shader.glsl => YUV.vert} (79%)
rename src/qcam/assets/shader/{NV_2_planes_UV_f.glsl => YUV_2_planes_UV.frag} (88%)
rename src/qcam/assets/shader/{NV_2_planes_VU_f.glsl => YUV_2_planes_VU.frag} (88%)
rename src/qcam/assets/shader/{NV_3_planes_f.glsl => YUV_3_planes.frag} (90%)
diff --git a/src/qcam/assets/shader/NV_vertex_shader.glsl b/src/qcam/assets/shader/YUV.vert
similarity index 79%
rename from src/qcam/assets/shader/NV_vertex_shader.glsl
rename to src/qcam/assets/shader/YUV.vert
index 12e791e31e32..f38e8045db89 100644
--- a/src/qcam/assets/shader/NV_vertex_shader.glsl
+++ b/src/qcam/assets/shader/YUV.vert
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2020, Linaro
*
- * NV_vertex_shader.glsl - Vertex shader code for NV family
+ * YUV.vert - Vertex shader for YUV to RGB conversion
*/
attribute vec4 vertexIn;
diff --git a/src/qcam/assets/shader/NV_2_planes_UV_f.glsl b/src/qcam/assets/shader/YUV_2_planes_UV.frag
similarity index 88%
rename from src/qcam/assets/shader/NV_2_planes_UV_f.glsl
rename to src/qcam/assets/shader/YUV_2_planes_UV.frag
index 67633a11ee0f..081caea9214b 100644
--- a/src/qcam/assets/shader/NV_2_planes_UV_f.glsl
+++ b/src/qcam/assets/shader/YUV_2_planes_UV.frag
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2020, Linaro
*
- * NV_2_planes_UV_f.glsl - Fragment shader code for NV12, NV16 and NV24 formats
+ * YUV_2_planes_UV.frag - Fragment shader code for NV12, NV16 and NV24 formats
*/
#ifdef GL_ES
diff --git a/src/qcam/assets/shader/NV_2_planes_VU_f.glsl b/src/qcam/assets/shader/YUV_2_planes_VU.frag
similarity index 88%
rename from src/qcam/assets/shader/NV_2_planes_VU_f.glsl
rename to src/qcam/assets/shader/YUV_2_planes_VU.frag
index 086c5b6d11bd..f4a5a5ac46c0 100644
--- a/src/qcam/assets/shader/NV_2_planes_VU_f.glsl
+++ b/src/qcam/assets/shader/YUV_2_planes_VU.frag
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2020, Linaro
*
- * NV_2_planes_VU_f.glsl - Fragment shader code for NV21, NV61 and NV42 formats
+ * YUV_2_planes_VU.frag - Fragment shader code for NV21, NV61 and NV42 formats
*/
#ifdef GL_ES
diff --git a/src/qcam/assets/shader/NV_3_planes_f.glsl b/src/qcam/assets/shader/YUV_3_planes.frag
similarity index 90%
rename from src/qcam/assets/shader/NV_3_planes_f.glsl
rename to src/qcam/assets/shader/YUV_3_planes.frag
index 4bc941842710..2be74b5d2a9d 100644
--- a/src/qcam/assets/shader/NV_3_planes_f.glsl
+++ b/src/qcam/assets/shader/YUV_3_planes.frag
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2020, Linaro
*
- * NV_3_planes_UV_f.glsl - Fragment shader code for YUV420 format
+ * YUV_3_planes_UV.frag - Fragment shader code for YUV420 format
*/
#ifdef GL_ES
diff --git a/src/qcam/assets/shader/shaders.qrc b/src/qcam/assets/shader/shaders.qrc
index 9ae35c9f70d6..533396d1fb28 100644
--- a/src/qcam/assets/shader/shaders.qrc
+++ b/src/qcam/assets/shader/shaders.qrc
@@ -1,9 +1,9 @@
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file>NV_vertex_shader.glsl</file>
- <file>NV_2_planes_UV_f.glsl</file>
- <file>NV_2_planes_VU_f.glsl</file>
- <file>NV_3_planes_f.glsl</file>
+ <file>YUV.vert</file>
+ <file>YUV_2_planes_UV.frag</file>
+ <file>YUV_2_planes_VU.frag</file>
+ <file>YUV_3_planes.frag</file>
</qresource>
</RCC>
diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
index 76e4a900a25a..0fa06a290959 100644
--- a/src/qcam/viewfinder_gl.cpp
+++ b/src/qcam/viewfinder_gl.cpp
@@ -101,42 +101,42 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format)
case libcamera::formats::NV12:
horzSubSample_ = 2;
vertSubSample_ = 2;
- fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_UV.frag";
break;
case libcamera::formats::NV21:
horzSubSample_ = 2;
vertSubSample_ = 2;
- fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_VU.frag";
break;
case libcamera::formats::NV16:
horzSubSample_ = 2;
vertSubSample_ = 1;
- fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_UV.frag";
break;
case libcamera::formats::NV61:
horzSubSample_ = 2;
vertSubSample_ = 1;
- fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_VU.frag";
break;
case libcamera::formats::NV24:
horzSubSample_ = 1;
vertSubSample_ = 1;
- fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_UV.frag";
break;
case libcamera::formats::NV42:
horzSubSample_ = 1;
vertSubSample_ = 1;
- fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl";
+ fragmentShaderSrc_ = ":YUV_2_planes_VU.frag";
break;
case libcamera::formats::YUV420:
horzSubSample_ = 2;
vertSubSample_ = 2;
- fragmentShaderSrc_ = ":NV_3_planes_f.glsl";
+ fragmentShaderSrc_ = ":YUV_3_planes.frag";
break;
case libcamera::formats::YVU420:
horzSubSample_ = 2;
vertSubSample_ = 2;
- fragmentShaderSrc_ = ":NV_3_planes_f.glsl";
+ fragmentShaderSrc_ = ":YUV_3_planes.frag";
break;
default:
ret = false;
@@ -154,7 +154,7 @@ bool ViewFinderGL::createVertexShader()
vertexShader_ = new QOpenGLShader(QOpenGLShader::Vertex, this);
/* Compile the vertex shader */
- if (!vertexShader_->compileSourceFile(":NV_vertex_shader.glsl")) {
+ if (!vertexShader_->compileSourceFile(":YUV.vert")) {
qWarning() << "[ViewFinderGL]:" << vertexShader_->log();
return false;
}
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list