| Message ID | 20260624085849.873784-4-bryan.odonoghue@linaro.org |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
On 24.06.26 10:58, Bryan O'Donoghue wrote: > We want to have the option to use floats as an intermediary format between > different stages of a multi-pass pipeline. Adding floats means also > plumbing the infrastructure to differentiate on data-type on the input to > texture creation. > > Add the floats and the plumbing. I understand that this patch simplified the rebase from the multi-pass series, however I would prefer if it was dropped here, given that it's otherwise unrelated. No strong opinion though and the code itself looks good to me, thus I'll leave that decision to you / others: Reviewed-by: Robert Mader <robert.mader@collabora.com> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > src/libcamera/egl.cpp | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp > index e83e24606..8d80a6d1a 100644 > --- a/src/libcamera/egl.cpp > +++ b/src/libcamera/egl.cpp > @@ -268,13 +268,29 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd) > */ > void eGL::createTexture2D(eGLImage &eglImage, void *data) > { > + GLenum format; > + GLenum type = GL_UNSIGNED_BYTE; > + > ASSERT(tid_ == Thread::currentId()); > > glActiveTexture(eglImage.texture_unit_); > glBindTexture(GL_TEXTURE_2D, eglImage.texture_); > > + switch (eglImage.format_) { > + case GL_R16F: > + format = GL_RED; > + type = GL_HALF_FLOAT; > + break; > + case GL_RG8: > + format = GL_RG; > + break; > + case GL_LUMINANCE: > + format = GL_LUMINANCE; > + break; > + } > + > // Generate texture, bind, associate image to texture, configure, unbind > - glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data); > + glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, format, type, data); > > // Nearest filtering > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
On 24/06/2026 12:58, Robert Mader wrote: >> Add the floats and the plumbing. > I understand that this patch simplified the rebase from the multi-pass > series, however I would prefer if it was dropped here, given that it's > otherwise unrelated. > > No strong opinion though and the code itself looks good to me, thus I'll > leave that decision to you / others: > > Reviewed-by: Robert Mader<robert.mader@collabora.com> Unless its a hard-NAK though, I'd rather get this in than rewrite everything and then rewrite everything again for multipass. I'll abuse your RB tyvm. --- bod
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > We want to have the option to use floats as an intermediary format between > different stages of a multi-pass pipeline. Adding floats means also > plumbing the infrastructure to differentiate on data-type on the input to > texture creation. > > Add the floats and the plumbing. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > src/libcamera/egl.cpp | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp > index e83e24606..8d80a6d1a 100644 > --- a/src/libcamera/egl.cpp > +++ b/src/libcamera/egl.cpp > @@ -268,13 +268,29 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd) > */ > void eGL::createTexture2D(eGLImage &eglImage, void *data) > { > + GLenum format; This is still left uninitialised, resulting in a compiler warning on the switch below. > + GLenum type = GL_UNSIGNED_BYTE; > + > ASSERT(tid_ == Thread::currentId()); > > glActiveTexture(eglImage.texture_unit_); > glBindTexture(GL_TEXTURE_2D, eglImage.texture_); > > + switch (eglImage.format_) { > + case GL_R16F: > + format = GL_RED; > + type = GL_HALF_FLOAT; > + break; > + case GL_RG8: > + format = GL_RG; > + break; > + case GL_LUMINANCE: > + format = GL_LUMINANCE; > + break; > + } > + > // Generate texture, bind, associate image to texture, configure, unbind > - glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data); > + glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, format, type, data); > > // Nearest filtering > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index e83e24606..8d80a6d1a 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -268,13 +268,29 @@ int eGL::createOutputDMABufTexture2D(eGLImage &eglImage, int fd) */ void eGL::createTexture2D(eGLImage &eglImage, void *data) { + GLenum format; + GLenum type = GL_UNSIGNED_BYTE; + ASSERT(tid_ == Thread::currentId()); glActiveTexture(eglImage.texture_unit_); glBindTexture(GL_TEXTURE_2D, eglImage.texture_); + switch (eglImage.format_) { + case GL_R16F: + format = GL_RED; + type = GL_HALF_FLOAT; + break; + case GL_RG8: + format = GL_RG; + break; + case GL_LUMINANCE: + format = GL_LUMINANCE; + break; + } + // Generate texture, bind, associate image to texture, configure, unbind - glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, eglImage.format_, GL_UNSIGNED_BYTE, data); + glTexImage2D(GL_TEXTURE_2D, 0, eglImage.format_, eglImage.width_, eglImage.height_, 0, format, type, data); // Nearest filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
We want to have the option to use floats as an intermediary format between different stages of a multi-pass pipeline. Adding floats means also plumbing the infrastructure to differentiate on data-type on the input to texture creation. Add the floats and the plumbing. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- src/libcamera/egl.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)