From patchwork Wed Sep 16 14:52:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9639 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AFFACC3B5B for ; Wed, 16 Sep 2020 14:54:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7CF5962F04; Wed, 16 Sep 2020 16:54:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DGO/KWUC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 772C760533 for ; Wed, 16 Sep 2020 16:54:25 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CABE7A62; Wed, 16 Sep 2020 16:53:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1600268058; bh=o8xR15gal8vxq7fjmWXi2TT2+G/hbSor7GlD8juUI88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGO/KWUCCKJUTrOuuKUJVCJpzaK063+79AAiywJsiVYRQSi6VD3oNbqbeNmlrUTqr rH9RhUfCdXLEphf0NeJqOy6q1z6btpJdDPR5QWNAqtiVrHDnu7MMFg4qfe1JOD0Cdr luNYkj56S7XKr8mqd96ZT5zRvB9eDFHI/OvsGUmE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 16 Sep 2020 17:52:50 +0300 Message-Id: <20200916145254.1644-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200916145254.1644-1-laurent.pinchart@ideasonboard.com> References: <20200916145254.1644-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/7] qcam: viewfinder_gl: Hardcode the vertex shader file name X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The GL renderer uses the same vertex shader for all formats. Hardcode the file name instead of storing it in a member variable. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/qcam/viewfinder_gl.cpp | 10 +--------- src/qcam/viewfinder_gl.h | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp index 18ebe46fe2f9..76e4a900a25a 100644 --- a/src/qcam/viewfinder_gl.cpp +++ b/src/qcam/viewfinder_gl.cpp @@ -101,49 +101,41 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format) case libcamera::formats::NV12: horzSubSample_ = 2; vertSubSample_ = 2; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl"; break; case libcamera::formats::NV21: horzSubSample_ = 2; vertSubSample_ = 2; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl"; break; case libcamera::formats::NV16: horzSubSample_ = 2; vertSubSample_ = 1; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl"; break; case libcamera::formats::NV61: horzSubSample_ = 2; vertSubSample_ = 1; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl"; break; case libcamera::formats::NV24: horzSubSample_ = 1; vertSubSample_ = 1; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_UV_f.glsl"; break; case libcamera::formats::NV42: horzSubSample_ = 1; vertSubSample_ = 1; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_2_planes_VU_f.glsl"; break; case libcamera::formats::YUV420: horzSubSample_ = 2; vertSubSample_ = 2; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_3_planes_f.glsl"; break; case libcamera::formats::YVU420: horzSubSample_ = 2; vertSubSample_ = 2; - vertexShaderSrc_ = ":NV_vertex_shader.glsl"; fragmentShaderSrc_ = ":NV_3_planes_f.glsl"; break; default: @@ -162,7 +154,7 @@ bool ViewFinderGL::createVertexShader() vertexShader_ = new QOpenGLShader(QOpenGLShader::Vertex, this); /* Compile the vertex shader */ - if (!vertexShader_->compileSourceFile(vertexShaderSrc_)) { + if (!vertexShader_->compileSourceFile(":NV_vertex_shader.glsl")) { qWarning() << "[ViewFinderGL]:" << vertexShader_->log(); return false; } diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h index 825af1c13cb7..7675d0a06351 100644 --- a/src/qcam/viewfinder_gl.h +++ b/src/qcam/viewfinder_gl.h @@ -73,9 +73,8 @@ private: /* Vertex buffer */ QOpenGLBuffer vertexBuffer_; - /* Fragment and Vertex shader file name */ + /* Fragment shader file name */ QString fragmentShaderSrc_; - QString vertexShaderSrc_; /* YUV texture planars and parameters */ GLuint textureUniformU_;