Merge branch 'release/1.9.x'

This commit is contained in:
rdb 2016-12-25 22:47:22 +01:00
commit ab5b5e7e74
15 changed files with 159 additions and 25 deletions

View File

@ -88,3 +88,7 @@ class EggCacher:
progress += size progress += size
cacher = EggCacher(sys.argv[1:]) cacher = EggCacher(sys.argv[1:])
# Dummy main function so this can be added to console_scripts.
def main():
return 0

View File

@ -419,3 +419,6 @@ else:
if not(os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")): if not(os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")):
exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!") exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!")
# Dummy main function so this can be added to console_scripts.
def main():
return 0

View File

@ -2,6 +2,7 @@
This issue fixes several bugs that were still found in 1.9.2. This issue fixes several bugs that were still found in 1.9.2.
* Fix crash when using homebrew Python on Mac OS X
* Fix crash when running in Steam on Linux when using OpenAL * Fix crash when running in Steam on Linux when using OpenAL
* Fix crash using wx/tkinter on Mac as long as want-wx/tk is set * Fix crash using wx/tkinter on Mac as long as want-wx/tk is set
* Fix loading models from 'models' package with models/ prefix * Fix loading models from 'models' package with models/ prefix
@ -50,6 +51,9 @@ This issue fixes several bugs that were still found in 1.9.2.
* GLSL: fix error when legacy matrix generator inputs are mat3 * GLSL: fix error when legacy matrix generator inputs are mat3
* Now tries to preserve refresh rate when switching fullscreen on Windows * Now tries to preserve refresh rate when switching fullscreen on Windows
* Fix back-to-front sorting when gl-coordinate-system is changed * Fix back-to-front sorting when gl-coordinate-system is changed
* Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1)
* get_keyboard_map now includes keys on layouts with special characters
* Fix crash due to incorrect alignment when compiling Eigen with AVX
------------------------ RELEASE 1.9.2 ------------------------ ------------------------ RELEASE 1.9.2 ------------------------
@ -74,6 +78,7 @@ remained in the 1.9.1 release, including:
* Fix constant reloading of texture when gl-ignore-mipmaps is set * Fix constant reloading of texture when gl-ignore-mipmaps is set
* BamReader now releases the GIL (so it can be used threaded) * BamReader now releases the GIL (so it can be used threaded)
* Fix AttributeError in direct.stdpy.threading module * Fix AttributeError in direct.stdpy.threading module
* Fix crash when writing 16-bit .tif file (now silently downsamples)
------------------------ RELEASE 1.9.1 ------------------------ ------------------------ RELEASE 1.9.1 ------------------------

View File

@ -374,7 +374,7 @@ typedef struct _object PyObject;
// externally. // externally.
#define MEMORY_HOOK_DO_ALIGN 1 #define MEMORY_HOOK_DO_ALIGN 1
#elif defined(IS_OSX) || defined(_WIN64) #elif (defined(IS_OSX) || defined(_WIN64)) && !defined(__AVX__)
// The OS-provided malloc implementation will do the required alignment. // The OS-provided malloc implementation will do the required alignment.
#undef MEMORY_HOOK_DO_ALIGN #undef MEMORY_HOOK_DO_ALIGN

View File

@ -43,7 +43,12 @@ get_memory_alignment() {
#ifdef LINMATH_ALIGN #ifdef LINMATH_ALIGN
// We require 16-byte alignment of certain structures, to support SSE2. We // We require 16-byte alignment of certain structures, to support SSE2. We
// don't strictly have to align *everything*, but it's just easier to do so. // don't strictly have to align *everything*, but it's just easier to do so.
#ifdef __AVX__
// Eigen requires 32-byte alignment when using AVX instructions.
const size_t alignment_size = 32;
#else
const size_t alignment_size = 16; const size_t alignment_size = 16;
#endif
#else #else
// Otherwise, align to two words. This seems to be pretty standard to the // Otherwise, align to two words. This seems to be pretty standard to the
// point where some code may rely on this being the case. // point where some code may rely on this being the case.
@ -66,6 +71,12 @@ get_header_reserved_bytes() {
// If we're doing SSE2 alignment, we must reserve a full 16-byte block, // If we're doing SSE2 alignment, we must reserve a full 16-byte block,
// since anything less than that will spoil the alignment. // since anything less than that will spoil the alignment.
static const size_t header_reserved_bytes = 16; static const size_t header_reserved_bytes = 16;
#ifdef __AVX__
// Eigen requires 32-byte alignment when using AVX instructions.
const size_t header_reserved_bytes = 32;
#else
const size_t header_reserved_bytes = 16;
#endif
#elif defined(MEMORY_HOOK_DO_ALIGN) #elif defined(MEMORY_HOOK_DO_ALIGN)
// If we're just aligning to words, we reserve a block as big as two words, // If we're just aligning to words, we reserve a block as big as two words,

View File

@ -53,8 +53,13 @@
// drose: We require 16-byte alignment of certain structures, to // drose: We require 16-byte alignment of certain structures, to
// support SSE2. We don't strictly have to align *everything*, but // support SSE2. We don't strictly have to align *everything*, but
// it's just easier to do so. // it's just easier to do so.
#ifdef __AVX__
// Eigen requires 32-byte alignment when using AVX instructions.
#define MALLOC_ALIGNMENT ((size_t)32U)
#else
#define MALLOC_ALIGNMENT ((size_t)16U) #define MALLOC_ALIGNMENT ((size_t)16U)
#endif #endif
#endif
#include "dlmalloc_src.cxx" #include "dlmalloc_src.cxx"

View File

@ -343,6 +343,9 @@ assert_failure(const char *expression, int line,
// guarantee it has already been constructed. // guarantee it has already been constructed.
ALIGN_16BYTE ConfigVariableBool assert_abort("assert-abort", false); ALIGN_16BYTE ConfigVariableBool assert_abort("assert-abort", false);
if (assert_abort) { if (assert_abort) {
// Make sure the error message has been flushed to the output.
nout.flush();
#ifdef WIN32 #ifdef WIN32
// How to trigger an exception in VC++ that offers to take us into the // How to trigger an exception in VC++ that offers to take us into the
// debugger? abort() doesn't do it. We used to be able to assert(false), // debugger? abort() doesn't do it. We used to be able to assert(false),

View File

@ -89,7 +89,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support
"ROCKET", "AWESOMIUM", # GUI libraries "ROCKET", "AWESOMIUM", # GUI libraries
"CARBON", "COCOA", # Mac OS X toolkits "CARBON", "COCOA", # Mac OS X toolkits
"X11", # Unix platform support "X11", # Unix platform support
"PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain "PANDATOOL", "PVIEW", "DEPLOYTOOLS", "DIRECTSCRIPTS",# Toolchain
"SKEL", # Example SKEL project "SKEL", # Example SKEL project
"PANDAFX", # Some distortion special lenses "PANDAFX", # Some distortion special lenses
"PANDAPARTICLESYSTEM", # Built in particle system "PANDAPARTICLESYSTEM", # Built in particle system
@ -805,9 +805,13 @@ if (COMPILER=="GCC"):
SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h") SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config") SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
if GetTarget() == "darwin" and not PkgSkip("FFMPEG"): if not PkgSkip("FFMPEG"):
LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") if GetTarget() == "darwin":
LibName("FFMPEG", "-framework VideoDecodeAcceleration") LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
LibName("FFMPEG", "-framework VideoDecodeAcceleration")
elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
# Needed when linking ffmpeg statically on Linux.
LibName("FFMPEG", "-Wl,-Bsymbolic")
cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV") cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
if cv_lib == "opencv_core": if cv_lib == "opencv_core":
@ -837,7 +841,7 @@ if (COMPILER=="GCC"):
if GetTarget() != 'darwin': if GetTarget() != 'darwin':
# CgGL is covered by the Cg framework, and we don't need X11 components on OSX # CgGL is covered by the Cg framework, and we don't need X11 components on OSX
if not PkgSkip("NVIDIACG") and not RUNTIME: if not PkgSkip("NVIDIACG") and not RUNTIME:
SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h") SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h", thirdparty_dir = "nvidiacg")
if not RUNTIME: if not RUNTIME:
SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h")) SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h"))
@ -1686,6 +1690,11 @@ def CompileLink(dll, obj, opts):
if LDFLAGS != "": if LDFLAGS != "":
cmd += " " + LDFLAGS cmd += " " + LDFLAGS
# Don't link libraries with Python.
if "PYTHON" in opts and GetOrigExt(dll) != ".exe" and not RTDIST:
opts = opts[:]
opts.remove("PYTHON")
for (opt, dir) in LIBDIRECTORIES: for (opt, dir) in LIBDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): if (opt=="ALWAYS") or (opt in opts):
cmd += ' -L' + BracketNameWithQuotes(dir) cmd += ' -L' + BracketNameWithQuotes(dir)
@ -4976,7 +4985,7 @@ if (PkgSkip("DIRECT")==0):
OPTS=['DIR:direct/src/directbase', 'PYTHON'] OPTS=['DIR:direct/src/directbase', 'PYTHON']
TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx') TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx')
if (PkgSkip("PYTHON")==0 and not RTDIST and not RUNTIME): if not PkgSkip("PYTHON") and not RTDIST and not RUNTIME and not PkgSkip("DIRECTSCRIPTS"):
DefSymbol("BUILDING:PACKPANDA", "IMPORT_MODULE", "direct.directscripts.packpanda") DefSymbol("BUILDING:PACKPANDA", "IMPORT_MODULE", "direct.directscripts.packpanda")
TargetAdd('packpanda.obj', opts=OPTS+['BUILDING:PACKPANDA'], input='ppython.cxx') TargetAdd('packpanda.obj', opts=OPTS+['BUILDING:PACKPANDA'], input='ppython.cxx')
TargetAdd('packpanda.exe', input='packpanda.obj') TargetAdd('packpanda.exe', input='packpanda.obj')

View File

@ -140,11 +140,14 @@ load_display_information() {
// _display_information->_device_id = CGDisplaySerialNumber(_display); // _display_information->_device_id = CGDisplaySerialNumber(_display);
// Display modes // Display modes
size_t num_modes = 0;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, NULL); CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, NULL);
size_t num_modes = CFArrayGetCount(modes); if (modes != NULL) {
_display_information->_total_display_modes = num_modes; num_modes = CFArrayGetCount(modes);
_display_information->_display_mode_array = new DisplayMode[num_modes]; _display_information->_total_display_modes = num_modes;
_display_information->_display_mode_array = new DisplayMode[num_modes];
}
for (size_t i = 0; i < num_modes; ++i) { for (size_t i = 0; i < num_modes; ++i) {
CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
@ -181,13 +184,17 @@ load_display_information() {
} }
CFRelease(encoding); CFRelease(encoding);
} }
CFRelease(modes); if (modes != NULL) {
CFRelease(modes);
}
#else #else
CFArrayRef modes = CGDisplayAvailableModes(_display); CFArrayRef modes = CGDisplayAvailableModes(_display);
size_t num_modes = CFArrayGetCount(modes); if (modes != NULL) {
_display_information->_total_display_modes = num_modes; num_modes = CFArrayGetCount(modes);
_display_information->_display_mode_array = new DisplayMode[num_modes]; _display_information->_total_display_modes = num_modes;
_display_information->_display_mode_array = new DisplayMode[num_modes];
}
for (size_t i = 0; i < num_modes; ++i) { for (size_t i = 0; i < num_modes; ++i) {
CFDictionaryRef mode = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i); CFDictionaryRef mode = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);

View File

@ -199,6 +199,7 @@ GLXContext glXCreateContextAttribsARB (X11_Display *dpy, GLXFBConfig config, GLX
#ifndef GLX_ARB_get_proc_address #ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1 #define GLX_ARB_get_proc_address 1
typedef void (*__GLXextFuncPtr)(void);
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
#ifdef GLX_GLXEXT_PROTOTYPES #ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);

View File

@ -430,7 +430,8 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
nassertr(!np.is_empty(), LMatrix4::ident_mat()); nassertr(!np.is_empty(), LMatrix4::ident_mat());
return np.get_transform()->get_mat(); return np.get_transform()->get_mat();
} else if (p->get_value_type() == ShaderInput::M_numeric && p->get_ptr()._size == 16) { } else if (p->get_value_type() == ShaderInput::M_numeric &&
p->get_ptr()._size >= 16 && (p->get_ptr()._size & 15) == 0) {
const Shader::ShaderPtrData &ptr = p->get_ptr(); const Shader::ShaderPtrData &ptr = p->get_ptr();
switch (ptr._type) { switch (ptr._type) {
@ -456,7 +457,7 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
} }
ostringstream strm; ostringstream strm;
strm << "Shader input " << id->get_name() << " is not a NodePath or LMatrix4.\n"; strm << "Shader input " << id->get_name() << " is not a NodePath, LMatrix4 or PTA_LMatrix4.\n";
nassert_raise(strm.str()); nassert_raise(strm.str());
return LMatrix4::ident_mat(); return LMatrix4::ident_mat();
} }

View File

@ -37,6 +37,13 @@ PythonThread(PyObject *function, PyObject *args,
} }
set_args(args); set_args(args);
#ifndef SIMPLE_THREADS
// Ensure that the Python threading system is initialized and ready to go.
#ifdef WITH_THREAD // This symbol defined within Python.h
PyEval_InitThreads();
#endif
#endif
} }
/** /**
@ -44,9 +51,20 @@ PythonThread(PyObject *function, PyObject *args,
*/ */
PythonThread:: PythonThread::
~PythonThread() { ~PythonThread() {
// Unfortunately, we need to grab the GIL to release these things,
// since the destructor could be called from any thread.
#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
#endif
Py_DECREF(_function); Py_DECREF(_function);
Py_XDECREF(_args); Py_XDECREF(_args);
Py_XDECREF(_result); Py_XDECREF(_result);
#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
PyGILState_Release(gstate);
#endif
} }
/** /**

View File

@ -1046,13 +1046,13 @@ write_data(xel *array, xelval *alpha) {
bytesperrow = _x_size * samplesperpixel; bytesperrow = _x_size * samplesperpixel;
} else if ( grayscale ) { } else if ( grayscale ) {
samplesperpixel = 1; samplesperpixel = 1;
bitspersample = pm_maxvaltobits( _maxval ); bitspersample = min(8, pm_maxvaltobits(_maxval));
photometric = PHOTOMETRIC_MINISBLACK; photometric = PHOTOMETRIC_MINISBLACK;
i = 8 / bitspersample; i = 8 / bitspersample;
bytesperrow = ( _x_size + i - 1 ) / i; bytesperrow = ( _x_size + i - 1 ) / i;
} else { } else {
samplesperpixel = 1; samplesperpixel = 1;
bitspersample = 8; bitspersample = min(8, pm_maxvaltobits(_maxval));
photometric = PHOTOMETRIC_PALETTE; photometric = PHOTOMETRIC_PALETTE;
bytesperrow = _x_size; bytesperrow = _x_size;
} }

View File

@ -22,6 +22,72 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#ifndef CPPPARSER
#ifndef VIDIOC_ENUM_FRAMESIZES
enum v4l2_frmsizetypes {
V4L2_FRMSIZE_TYPE_DISCRETE = 1,
V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
V4L2_FRMSIZE_TYPE_STEPWISE = 3,
};
struct v4l2_frmsize_discrete {
__u32 width;
__u32 height;
};
struct v4l2_frmsize_stepwise {
__u32 min_width;
__u32 max_width;
__u32 step_width;
__u32 min_height;
__u32 max_height;
__u32 step_height;
};
struct v4l2_frmsizeenum {
__u32 index;
__u32 pixel_format;
__u32 type;
union {
struct v4l2_frmsize_discrete discrete;
struct v4l2_frmsize_stepwise stepwise;
};
__u32 reserved[2];
};
#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
#endif
#ifndef VIDIOC_ENUM_FRAMEINTERVALS
enum v4l2_frmivaltypes {
V4L2_FRMIVAL_TYPE_DISCRETE = 1,
V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
V4L2_FRMIVAL_TYPE_STEPWISE = 3,
};
struct v4l2_frmival_stepwise {
struct v4l2_fract min;
struct v4l2_fract max;
struct v4l2_fract step;
};
struct v4l2_frmivalenum {
__u32 index;
__u32 pixel_format;
__u32 width;
__u32 height;
__u32 type;
union {
struct v4l2_fract discrete;
struct v4l2_frmival_stepwise stepwise;
};
__u32 reserved[2];
};
#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
#endif
#endif
TypeHandle WebcamVideoV4L::_type_handle; TypeHandle WebcamVideoV4L::_type_handle;
/** /**

View File

@ -2570,7 +2570,7 @@ ButtonMap *WinGraphicsWindow::
get_keyboard_map() const { get_keyboard_map() const {
ButtonMap *map = new ButtonMap; ButtonMap *map = new ButtonMap;
char text[256]; wchar_t text[256];
UINT vsc = 0; UINT vsc = 0;
unsigned short ex_vsc[] = {0x57, 0x58, unsigned short ex_vsc[] = {0x57, 0x58,
0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d}; 0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d};
@ -2608,14 +2608,15 @@ get_keyboard_map() const {
UINT vk = MapVirtualKeyA(vsc, MAPVK_VSC_TO_VK_EX); UINT vk = MapVirtualKeyA(vsc, MAPVK_VSC_TO_VK_EX);
button = lookup_key(vk); button = lookup_key(vk);
if (button == ButtonHandle::none()) { //if (button == ButtonHandle::none()) {
continue; // continue;
} //}
} }
int len = GetKeyNameTextA(lparam, text, 256); int len = GetKeyNameTextW(lparam, text, 256);
string label (text, len); TextEncoder enc;
map->map_button(raw_button, button, label); enc.set_wtext(wstring(text, len));
map->map_button(raw_button, button, enc.get_text());
} }
return map; return map;