[PATCH 22/27] libcamera: software_isp: egl: Bind each eglImage to its own texture unit
Bryan O'Donoghue
bryan.odonoghue at linaro.org
Tue Apr 22 23:59:15 CEST 2025
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
src/libcamera/software_isp/egl.cpp | 1 +
src/libcamera/software_isp/egl.h | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/libcamera/software_isp/egl.cpp b/src/libcamera/software_isp/egl.cpp
index c3eb8290..885eaa84 100644
--- a/src/libcamera/software_isp/egl.cpp
+++ b/src/libcamera/software_isp/egl.cpp
@@ -85,6 +85,7 @@ void eGL::destroyDMABufTexture(eGLImage *eglImage)
// Generate a 2D texture from an input buffer directly
void eGL::createTexture2D(eGLImage *eglImage, uint32_t width, uint32_t height, void *data)
{
+ glActiveTexture(eglImage->texture_unit_);
glBindTexture(GL_TEXTURE_2D, eglImage->texture_);
// Generate texture, bind, associate image to texture, configure, unbind
diff --git a/src/libcamera/software_isp/egl.h b/src/libcamera/software_isp/egl.h
index f3c5d50f..64cf2a87 100644
--- a/src/libcamera/software_isp/egl.h
+++ b/src/libcamera/software_isp/egl.h
@@ -29,13 +29,15 @@ LOG_DECLARE_CATEGORY(eGL)
class eGLImage {
public:
- eGLImage(uint32_t width, uint32_t height, uint32_t bpp) {
+ eGLImage(uint32_t width, uint32_t height, uint32_t bpp, GLenum texture_unit, uint32_t texture_unit_uniform_id) {
image_ = EGL_NO_IMAGE_KHR;
width_ = width;
height_ = height;
bpp_ = bpp;
stride_ = width_ * bpp_ / 4;
framesize_ = stride_ * height_;
+ texture_unit_ = texture_unit;
+ texture_unit_uniform_id_ = texture_unit_uniform_id;
glGenTextures(1, &texture_);
}
@@ -44,14 +46,16 @@ public:
glDeleteTextures(1, &texture_);
};
- GLuint texture_;
- EGLImageKHR image_;
uint32_t width_;
uint32_t height_;
uint32_t stride_;
uint32_t offset_;
uint32_t framesize_;
uint32_t bpp_;
+ uint32_t texture_unit_uniform_id_;
+ GLenum texture_unit_;
+ GLuint texture_;
+ EGLImageKHR image_;
};
class eGL
--
2.49.0
More information about the libcamera-devel
mailing list