[10/30] libcamera: software_isp: gpu_pipeline_shader_pass: Move common attribute and uniform variables to base shader class
diff mbox series

Message ID 20260618122245.946138-11-bryan.odonoghue@linaro.org
State RFC
Headers show
Series
  • RFC/RFT: gpuisp: Multipass with speed optimisations on top
Related show

Commit Message

Bryan O'Donoghue June 18, 2026, 12:22 p.m. UTC
Every shader pass will want to set these variables so define them in the
base class not in the demosiac class.

Render therefore unto Cesar the things which are Cesar's.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../software_isp/gpu_pipeline_shader_pass.h         | 13 +++++++++++++
 .../gpu_pipeline_shader_pass_demosiac.h             | 10 ----------
 2 files changed, 13 insertions(+), 10 deletions(-)

Comments

Milan Zamazal June 23, 2026, 12:17 p.m. UTC | #1
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:

> Every shader pass will want to set these variables so define them in the
> base class not in the demosiac class.

demosaic

> Render therefore unto Cesar the things which are Cesar's.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  .../software_isp/gpu_pipeline_shader_pass.h         | 13 +++++++++++++
>  .../gpu_pipeline_shader_pass_demosiac.h             | 10 ----------
>  2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
> index d4d4cf34d..d55b27a85 100644
> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
> @@ -78,6 +78,19 @@ protected:
>  
>  	struct PassConfig passInputCfg_;
>  	struct PassConfig passOutputCfg_;
> +
> +	/* Common shader attributes */
> +	GLint attributeVertex_;
> +	GLint attributeTexture_;
> +	GLint textureUniformProjMatrix_;

Is this one used in more than one?

> +	GLint textureUniformBayerDataIn_;

This one only for processing raw data?

> +	GLint textureUniformStrideFactor_;
> +	uint32_t shaderStridePixels_;
> +
> +	/* Bayer shader parameters - useful to potentially more than one shader */
> +	GLint textureUniformBayerFirstRed_;
> +	float firstRed_x_;
> +	float firstRed_y_;

Not sure what exactly should be here or whether there should be
intermediate classes (like for processing raw and demosaiced buffers).
Not that important though and code deduplication may be more important
than a few wasted bytes.

>  };
>  
>  } /* namespace libcamera */
> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
> index 11bb04c30..60f175ad3 100644
> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
> @@ -43,18 +43,8 @@ public:
>  	const char *name() const override { return "GpuIspShaderPassDemosiac"; }
>  private:
>  	/* Shader parameters */
> -	float firstRed_x_;
> -	float firstRed_y_;
> -	GLint attributeVertex_;
> -	GLint attributeTexture_;
>  	GLint textureUniformStep_;
>  	GLint textureUniformSize_;
> -	GLint textureUniformStrideFactor_;
> -	GLint textureUniformBayerFirstRed_;
> -	GLint textureUniformProjMatrix_;
> -	GLint textureUniformBayerDataIn_;
> -
> -	uint32_t shaderStridePixels_;
>  
>  	/* Represent per-frame CCM as a uniform vector of floats 3 x 3 */
>  	GLint ccmUniformDataIn_;

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
index d4d4cf34d..d55b27a85 100644
--- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h
@@ -78,6 +78,19 @@  protected:
 
 	struct PassConfig passInputCfg_;
 	struct PassConfig passOutputCfg_;
+
+	/* Common shader attributes */
+	GLint attributeVertex_;
+	GLint attributeTexture_;
+	GLint textureUniformProjMatrix_;
+	GLint textureUniformBayerDataIn_;
+	GLint textureUniformStrideFactor_;
+	uint32_t shaderStridePixels_;
+
+	/* Bayer shader parameters - useful to potentially more than one shader */
+	GLint textureUniformBayerFirstRed_;
+	float firstRed_x_;
+	float firstRed_y_;
 };
 
 } /* namespace libcamera */
diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
index 11bb04c30..60f175ad3 100644
--- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h
@@ -43,18 +43,8 @@  public:
 	const char *name() const override { return "GpuIspShaderPassDemosiac"; }
 private:
 	/* Shader parameters */
-	float firstRed_x_;
-	float firstRed_y_;
-	GLint attributeVertex_;
-	GLint attributeTexture_;
 	GLint textureUniformStep_;
 	GLint textureUniformSize_;
-	GLint textureUniformStrideFactor_;
-	GLint textureUniformBayerFirstRed_;
-	GLint textureUniformProjMatrix_;
-	GLint textureUniformBayerDataIn_;
-
-	uint32_t shaderStridePixels_;
 
 	/* Represent per-frame CCM as a uniform vector of floats 3 x 3 */
 	GLint ccmUniformDataIn_;