@@ -298,6 +298,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm
return -ENODEV;
}
+ setShaderUniformValues();
+
return 0;
}
@@ -408,7 +410,7 @@ uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const
return info.stride(size.width, 0, 256);
}
-void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams ¶ms)
+void DebayerEGL::setShaderUniformValues()
{
/*
* Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats
@@ -459,13 +461,6 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara
glVertexAttribPointer(attributeTexture_, 2, GL_FLOAT, GL_TRUE,
2 * sizeof(GLfloat), tcoordinates);
- /*
- * Set the sampler2D to the respective texture unit for each texutre
- * To simultaneously sample multiple textures we need to use multiple
- * texture units
- */
- glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);
-
/*
* These values are:
* firstRed = tex_bayer_first_red - bayer_8.vert
@@ -496,6 +491,16 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara
<< " textureUniformStep_.y " << Step[1]
<< " textureUniformStrideFactor_ " << Stride
<< " textureUniformProjMatrix_ " << textureUniformProjMatrix_;
+}
+
+void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams ¶ms)
+{
+ /*
+ * Set the sampler2D to the respective texture unit for each texutre
+ * To simultaneously sample multiple textures we need to use multiple
+ * texture units
+ */
+ glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);
/* Pre-transpose matrix for GLES 2.0. */
Matrix<float, 3, 3> ccm = params.combinedMatrix.transpose();
@@ -66,6 +66,7 @@ private:
static int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config);
int initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat);
int getShaderVariableLocations();
+ void setShaderUniformValues();
void setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams ¶ms);
int debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer);
Both uniforms and attributes in GLSL do not change from one shader invocation to another, allowing static value assignments to be moved out of the main loop, and only be assigned on start. This results in only a negligible performance increase. Signed-off-by: Remy Alipoursafari <remy.alipoursafari@collabora.com> --- src/libcamera/software_isp/debayer_egl.cpp | 21 +++++++++++++-------- src/libcamera/software_isp/debayer_egl.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-)