Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2021-02-24 12:14:04 +01:00
commit 7a838e7212
4 changed files with 67 additions and 7 deletions

View File

@ -124,7 +124,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)

View File

@ -300,7 +300,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()
@ -308,7 +308,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)

View File

@ -19,6 +19,8 @@
#include "config_egldisplay.h"
#include "frameBufferProperties.h"
#include <EGL/eglext.h>
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: "
@ -165,10 +220,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;
}
}

View File

@ -30,6 +30,7 @@
#include "boundingSphere.h"
#include "boundingBox.h"
#include "config_mathutil.h"
#include "pipeline.h"
#ifdef HAVE_AUDIO
#include "audioSound.h"