From 778c6ee6bec8b9603341350662b206a303ccafcd Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 09:46:26 +0100 Subject: [PATCH 1/6] pgui: Add missing pipeline.h include --- panda/src/pgui/pgItem.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/pgui/pgItem.cxx b/panda/src/pgui/pgItem.cxx index 663522204a..74201d01b0 100644 --- a/panda/src/pgui/pgItem.cxx +++ b/panda/src/pgui/pgItem.cxx @@ -30,6 +30,7 @@ #include "boundingSphere.h" #include "boundingBox.h" #include "config_mathutil.h" +#include "pipeline.h" #ifdef HAVE_AUDIO #include "audioSound.h" From ea49c121a08c73ecd3eabe0b8265f759506ad683 Mon Sep 17 00:00:00 2001 From: Michael Wass Date: Tue, 23 Feb 2021 17:11:10 -0500 Subject: [PATCH 2/6] direct: fix TypeError caused by py3 division changes --- direct/src/distributed/DistributedObject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index 84870b890c..81f03f8fc8 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -125,7 +125,7 @@ class DistributedObject(DistributedObjectBase): if field is not None: p = DCPacker() p.setUnpackData(field.getDefaultValue()) - len = p.rawUnpackUint16()/4 + len = p.rawUnpackUint16() // 4 for i in range(len): zone = int(p.rawUnpackUint32()) autoInterests.add(zone) From f84111a693b3224b75631a64489c2b0b3b37438d Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 09:39:47 +0100 Subject: [PATCH 3/6] makepanda: Don't disable Cg/FMODEx on macOS without arch flags Fixes #1119 --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 69b0b207fd..9c57b37129 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -934,7 +934,7 @@ if (COMPILER=="GCC"): PkgDisable("CARBON") if GetTarget() == 'darwin': - if 'x86_64' not in OSX_ARCHS and 'i386' not in OSX_ARCHS: + if OSX_ARCHS and 'x86_64' not in OSX_ARCHS and 'i386' not in OSX_ARCHS: # These support only these archs, so don't build them if we're not # targeting any of the supported archs. PkgDisable("FMODEX") From 7f20bcd8e09d7ca784b46f2298000cc5131e67d0 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 10:11:41 +0100 Subject: [PATCH 4/6] egl: Fix ability to create multisample FBO Fixes #1089 --- panda/src/egldisplay/eglGraphicsPipe.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/panda/src/egldisplay/eglGraphicsPipe.cxx b/panda/src/egldisplay/eglGraphicsPipe.cxx index 18c2317664..86a9b4cf73 100644 --- a/panda/src/egldisplay/eglGraphicsPipe.cxx +++ b/panda/src/egldisplay/eglGraphicsPipe.cxx @@ -165,10 +165,9 @@ make_output(const std::string &name, // Early failure - if we are sure that this buffer WONT meet specs, we can // bail out early. if ((flags & BF_fb_props_optional)==0) { - if ((fb_prop.get_indexed_color() > 0)|| - (fb_prop.get_back_buffers() > 0)|| - (fb_prop.get_accum_bits() > 0)|| - (fb_prop.get_multisamples() > 0)) { + if (fb_prop.get_indexed_color() > 0 || + fb_prop.get_back_buffers() > 0 || + fb_prop.get_accum_bits() > 0) { return nullptr; } } From 2e38ca10429d904455bcfdeb395e2f20c50b01f2 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 11:41:42 +0100 Subject: [PATCH 5/6] egl: Fall back to EGL_EXT_platform_device for device selection See #557 --- panda/src/egldisplay/eglGraphicsPipe.cxx | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/panda/src/egldisplay/eglGraphicsPipe.cxx b/panda/src/egldisplay/eglGraphicsPipe.cxx index 86a9b4cf73..e3df7e8a97 100644 --- a/panda/src/egldisplay/eglGraphicsPipe.cxx +++ b/panda/src/egldisplay/eglGraphicsPipe.cxx @@ -19,6 +19,8 @@ #include "config_egldisplay.h" #include "frameBufferProperties.h" +#include + TypeHandle eglGraphicsPipe::_type_handle; /** @@ -26,6 +28,27 @@ TypeHandle eglGraphicsPipe::_type_handle; */ eglGraphicsPipe:: eglGraphicsPipe() { + // Check for client extensions. + vector_string extensions; + const char *ext_ptr = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + if (ext_ptr != nullptr) { + extract_words(ext_ptr, extensions); + + if (egldisplay_cat.is_debug()) { + std::ostream &out = egldisplay_cat.debug() + << "Supported EGL client extensions:\n"; + + for (const std::string &extension : extensions) { + out << " " << extension << "\n"; + } + } + } + else if (egldisplay_cat.is_debug()) { + eglGetError(); + egldisplay_cat.debug() + << "EGL client extensions not supported.\n"; + } + //NB. if the X11 display failed to open, _display will be 0, which is a valid // input to eglGetDisplay - it means to open the default display. #ifdef HAVE_X11 @@ -33,6 +56,38 @@ eglGraphicsPipe() { #else _egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); #endif + + if (!_egl_display && + std::find(extensions.begin(), extensions.end(), "EGL_EXT_platform_device") != extensions.end() && + std::find(extensions.begin(), extensions.end(), "EGL_EXT_device_enumeration") != extensions.end()) { + + PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT = + (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT"); + + EGLint num_devices = 0; + if (eglQueryDevicesEXT(0, nullptr, &num_devices) && num_devices > 0) { + EGLDeviceEXT *devices = (EGLDeviceEXT *)alloca(sizeof(EGLDeviceEXT) * num_devices); + eglQueryDevicesEXT(num_devices, devices, &num_devices); + + if (egldisplay_cat.is_debug()) { + egldisplay_cat.debug() + << "Found " << num_devices << " EGL devices.\n"; + } + + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = + (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT"); + + for (EGLint i = 0; i < num_devices && !_egl_display; ++i) { + _egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, devices[i], nullptr); + } + } + + if (!_egl_display) { + egldisplay_cat.error() + << "Couldn't find a suitable EGL platform device.\n"; + } + } + if (!eglInitialize(_egl_display, nullptr, nullptr)) { egldisplay_cat.error() << "Couldn't initialize the EGL display: " From ce437629c2c78c9aea6bd7a456e09770407d9929 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 24 Feb 2021 11:48:10 +0100 Subject: [PATCH 6/6] filter: Respect depth-bits from Config.prc --- direct/src/filter/FilterManager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/direct/src/filter/FilterManager.py b/direct/src/filter/FilterManager.py index fd3cda3921..7e76bd686a 100644 --- a/direct/src/filter/FilterManager.py +++ b/direct/src/filter/FilterManager.py @@ -299,7 +299,7 @@ class FilterManager(DirectObject): return quad - def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1, fbprops=None): + def createBuffer(self, name, xsize, ysize, texgroup, depthbits=True, fbprops=None): """ Low-level buffer creation. Not intended for public use. """ winprops = WindowProperties() @@ -307,7 +307,12 @@ class FilterManager(DirectObject): props = FrameBufferProperties(FrameBufferProperties.getDefault()) props.setBackBuffers(0) props.setRgbColor(1) - props.setDepthBits(depthbits) + if depthbits is True: + # Respect depth-bits from Config.prc + if props.getDepthBits() == 0: + props.setDepthBits(1) + else: + props.setDepthBits(depthbits) props.setStereo(self.win.isStereo()) if fbprops is not None: props.addProperties(fbprops)