From 5ceaf66079451b08c66c28cff6f975e479b45c4a Mon Sep 17 00:00:00 2001 From: Geraldo Nascimento Date: Tue, 3 May 2022 18:56:28 -0300 Subject: [PATCH 1/3] v4l: O_NONBLOCK flag should be OR'ed to O_RDWR or mmap will fail below Closes #1299 --- panda/src/vision/webcamVideoCursorV4L.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index 197bda3228..1939b16912 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -217,7 +217,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { int mode = O_RDWR; if (!v4l_blocking) { - mode = O_NONBLOCK; + mode |= O_NONBLOCK; } _fd = open(src->_device.c_str(), mode); From d98f9666930bd22b88b8485b0e3aeb16095d1f7f Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 May 2022 10:38:25 +0200 Subject: [PATCH 2/3] display: Extra spam message about what window a flip is done for --- panda/src/display/graphicsEngine.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index c93228b7c5..4fcbd323a2 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -1678,7 +1678,8 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { if (host->flip_ready()) { if (display_cat.is_spam()) { display_cat.spam() - << "Flipping window " << win->get_name() << "\n"; + << "Flipping window " << host->get_name() + << " before drawing window " << win->get_name() << "\n"; } { // We can't use a PStatGPUTimer before begin_frame, so when using From d2fc682fd73e09cd356253e9141c5988b1a978a5 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 5 May 2022 10:40:22 +0200 Subject: [PATCH 3/3] glgsg: Support floating-point FBOs in OpenGL ES 2+ See issue #1296 --- panda/src/glstuff/glGraphicsBuffer_src.cxx | 53 +++++++++++++++++++ .../glstuff/glGraphicsStateGuardian_src.cxx | 8 ++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 35a4e2f5db..ea573a13e0 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -861,6 +861,50 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, // case RTP_stencil: gl_format = GL_STENCIL_INDEX8; break default: if (_fb_properties.get_alpha_bits() == 0) { +#ifndef OPENGLES_1 + if (_fb_properties.get_float_color() && + glgsg->has_extension("GL_EXT_color_buffer_float")) { + // This extension supports the full range of floating-point formats. + if (_fb_properties.get_color_bits() > 16 * 3 || + _fb_properties.get_red_bits() > 16 || + _fb_properties.get_green_bits() > 16 || + _fb_properties.get_blue_bits() > 16) { + // 32-bit, which is always floating-point. + if (_fb_properties.get_blue_bits() > 0 || + _fb_properties.get_color_bits() == 1 || + _fb_properties.get_color_bits() > 32 * 2) { + gl_format = GL_RGB32F; + } else if (_fb_properties.get_green_bits() > 0 || + _fb_properties.get_color_bits() > 32) { + gl_format = GL_RG32F; + } else { + gl_format = GL_R32F; + } + } else { + // 16-bit floating-point. + if (_fb_properties.get_blue_bits() > 10 || + _fb_properties.get_color_bits() == 1 || + _fb_properties.get_color_bits() > 32) { + gl_format = GL_RGB16F; + } else if (_fb_properties.get_blue_bits() > 0) { + if (_fb_properties.get_red_bits() > 11 || + _fb_properties.get_green_bits() > 11) { + gl_format = GL_RGB16F; + } else { + gl_format = GL_R11F_G11F_B10F; + } + } else if (_fb_properties.get_green_bits() > 0 || + _fb_properties.get_color_bits() > 16) { + gl_format = GL_RG16F; + } else { + gl_format = GL_R16F; + } + } + } else if (_fb_properties.get_float_color() && + glgsg->has_extension("GL_EXT_color_buffer_half_float")) { + gl_format = GL_RGB16F_EXT; + } else +#endif if (_fb_properties.get_color_bits() <= 16) { gl_format = GL_RGB565_OES; } else if (_fb_properties.get_color_bits() <= 24) { @@ -868,6 +912,15 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot, } else { gl_format = GL_RGB10_EXT; } +#ifndef OPENGLES_1 + } else if (_fb_properties.get_float_color() && + _fb_properties.get_color_bits() > 16 * 3 && + glgsg->has_extension("GL_EXT_color_buffer_float")) { + gl_format = GL_RGBA32F_EXT; + } else if (_fb_properties.get_float_color() && + glgsg->has_extension("GL_EXT_color_buffer_half_float")) { + gl_format = GL_RGBA16F_EXT; +#endif } else if (_fb_properties.get_color_bits() == 0) { gl_format = GL_ALPHA8_EXT; } else if (_fb_properties.get_color_bits() <= 12 diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 4884fb9c20..c536ed6747 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -10322,9 +10322,15 @@ get_internal_image_format(Texture *tex, bool force_sized) const { } else { return GL_RGBA16_SNORM; } +#elif !defined(OPENGLES_1) + case Texture::F_rgba16: + return GL_RGBA16F; +#endif // OPENGLES + +#ifndef OPENGLES_1 case Texture::F_rgba32: return GL_RGBA32F; -#endif // OPENGLES +#endif case Texture::F_rgb: switch (component_type) {