| Message ID | 20260618122245.946138-22-bryan.odonoghue@linaro.org |
|---|---|
| State | RFC |
| Headers | show |
| Series |
|
| Related | show |
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > include/libcamera/internal/egl.h | 1 + > src/libcamera/egl.cpp | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h > index 182a4dc55..d3749d2e7 100644 > --- a/include/libcamera/internal/egl.h > +++ b/include/libcamera/internal/egl.h > @@ -107,6 +107,7 @@ public: > int createInputDMABufTexture2D(eGLImage &eglImage, int fd); > int createOutputDMABufTexture2D(eGLImage &eglImage, int fd); > void createInputTexture2D(eGLImage &eglImage, void *data); > + void createOutputTexture2D(eGLImage &eglImage); > > int attachTextureToFBO(eGLImage &eglImage); > > diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp > index ffaa6bc49..8d135e092 100644 > --- a/src/libcamera/egl.cpp > +++ b/src/libcamera/egl.cpp > @@ -297,6 +297,22 @@ void eGL::createInputTexture2D(eGLImage &eglImage, void *data) > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); > } > > +/** > + * \brief Create a 2D texture attached to an FBO for render-to-texture > + * \param[in,out] eglImage EGL image to associate with the texture > + * \param[in] format OpenGL internal format (e.g., GL_RGB, GL_RGBA) There is no such argument. > + * > + * Creates a 2D texture in VRAM. The texture > + * is configured with nearest filtering and clamp-to-edge wrapping. This > + * is useful for uploading static data like lookup tables or uniform color > + * matrices to the GPU. Really? > + */ > +void eGL::createOutputTexture2D(eGLImage &eglImage) > +{ > + createInputTexture2D(eglImage, NULL); > + attachTextureToFBO(eglImage); > +} > + > /** > * \brief Initialise the EGL context > *
diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 182a4dc55..d3749d2e7 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -107,6 +107,7 @@ public: int createInputDMABufTexture2D(eGLImage &eglImage, int fd); int createOutputDMABufTexture2D(eGLImage &eglImage, int fd); void createInputTexture2D(eGLImage &eglImage, void *data); + void createOutputTexture2D(eGLImage &eglImage); int attachTextureToFBO(eGLImage &eglImage); diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index ffaa6bc49..8d135e092 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -297,6 +297,22 @@ void eGL::createInputTexture2D(eGLImage &eglImage, void *data) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } +/** + * \brief Create a 2D texture attached to an FBO for render-to-texture + * \param[in,out] eglImage EGL image to associate with the texture + * \param[in] format OpenGL internal format (e.g., GL_RGB, GL_RGBA) + * + * Creates a 2D texture in VRAM. The texture + * is configured with nearest filtering and clamp-to-edge wrapping. This + * is useful for uploading static data like lookup tables or uniform color + * matrices to the GPU. + */ +void eGL::createOutputTexture2D(eGLImage &eglImage) +{ + createInputTexture2D(eglImage, NULL); + attachTextureToFBO(eglImage); +} + /** * \brief Initialise the EGL context *
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- include/libcamera/internal/egl.h | 1 + src/libcamera/egl.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)