Backport various bugfixes from master, among which:

- Fix Windows pbuffer crash on Intel cards
 - Fix crash when using pnmimage.write with unsupported format
 - Fix GLSL diagnostics on Mesa GLES2 compiler
 - Reduce warning severity when resizing immutable storage texture
 - Print more debug info when FrameBufferProperties are insufficient
 - Fix "Bam file contains objects of unknown type: MovingPart<LMatrix4f>"
 - Fix memory leak in BulletTriangleMesh
 - Fix pmerge in Python 3
This commit is contained in:
rdb 2016-06-07 14:40:27 +02:00
parent 3951a191a3
commit d53b2ca80e
11 changed files with 49 additions and 16 deletions

View File

@ -35,7 +35,7 @@ class SeqValue:
""" Sets the seq from the indicated string of dot-separated
integers. Raises ValueError on error. """
assert isinstance(value, types.StringTypes)
self.value = ()
if value:
value = value.split('.')
@ -77,9 +77,14 @@ class SeqValue:
""" Compares to another seq value. """
return cmp(self.value, other.value)
def __lt__(self, other):
return self.value < other.value
def __gt__(self, other):
return self.value > other.value
def __bool__(self):
return bool(self.value)
def __str__(self):
return 'SeqValue%s' % (repr(self.value))

View File

@ -250,7 +250,7 @@ inline static unsigned CountDecimalDigit32(uint32_t n) {
}
inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 0, 0, 0, 0, 0 };
const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
const DiyFp wp_w = Mp - W;
uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);

View File

@ -20,10 +20,10 @@ else:
import cPickle as pickle
import thread
SUFFIX_INC = [".cxx",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r"]
SUFFIX_INC = [".cxx",".cpp",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r"]
SUFFIX_DLL = [".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd",".ocx"]
SUFFIX_LIB = [".lib",".ilb"]
VCS_DIRS = set(["CVS", "CVSROOT", ".git", ".hg"])
VCS_DIRS = set(["CVS", "CVSROOT", ".git", ".hg", "__pycache__"])
VCS_FILES = set([".cvsignore", ".gitignore", ".gitmodules", ".hgignore"])
STARTTIME = time.time()
MAINTHREAD = threading.currentThread()

View File

@ -21,7 +21,7 @@ INLINE BulletHeightfieldShape::
~BulletHeightfieldShape() {
delete _shape;
delete _data;
delete [] _data;
}
////////////////////////////////////////////////////////////////////

View File

@ -149,6 +149,8 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices, const TransformState
_mesh->addTriangle(v0, v1, v2, remove_duplicate_vertices);
}
}
delete [] vertices;
}
////////////////////////////////////////////////////////////////////
@ -180,6 +182,8 @@ add_array(const PTA_LVecBase3 &points, const PTA_int &indices, bool remove_dupli
_mesh->addTriangle(v0, v1, v2, remove_duplicate_vertices);
}
delete [] vertices;
}
////////////////////////////////////////////////////////////////////

View File

@ -146,6 +146,17 @@ ConfigureFn(config_chan) {
AnimChannelScalarTable::register_with_read_factory();
AnimChannelScalarDynamic::register_with_read_factory();
AnimPreloadTable::register_with_read_factory();
// For compatibility with old .bam files.
#ifndef STDFLOAT_DOUBLE
TypeRegistry *reg = TypeRegistry::ptr();
reg->record_alternate_name(AnimChannelFixed<ACMatrixSwitchType>::get_class_type(),
"AnimChannelFixed<LMatrix4f>");
reg->record_alternate_name(MovingPart<ACMatrixSwitchType>::get_class_type(),
"MovingPart<LMatrix4f>");
reg->record_alternate_name(MovingPart<ACScalarSwitchType>::get_class_type(),
"MovingPart<float>");
#endif
}

View File

@ -437,6 +437,9 @@ make_output(GraphicsPipe *pipe,
if (flags & GraphicsPipe::BF_fb_props_optional) {
display_cat.warning()
<< "FrameBufferProperties available less than requested.\n";
display_cat.warning(false)
<< " requested: " << fb_prop << "\n"
<< " got: " << window->get_fb_properties() << "\n";
return window;
}
display_cat.error()

View File

@ -10745,7 +10745,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
}
if (needs_reload && gtc->_immutable) {
GLCAT.warning() << "Attempt to modify texture with immutable storage, recreating texture.\n";
GLCAT.info() << "Attempt to modify texture with immutable storage, recreating texture.\n";
gtc->reset_data();
glBindTexture(target, gtc->_index);
}

View File

@ -1861,10 +1861,10 @@ glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal) {
istringstream log(info_log);
string line;
while (getline(log, line)) {
int fileno, lineno;
int fileno, lineno, colno;
int prefixlen = 0;
// First is AMD/Intel driver syntax, second is NVIDIA syntax.
// This first format is used by the majority of compilers.
if (sscanf(line.c_str(), "ERROR: %d:%d: %n", &fileno, &lineno, &prefixlen) == 2
&& prefixlen > 0) {
@ -1879,14 +1879,22 @@ glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal) {
GLCAT.warning(false)
<< "WARNING: " << fn << ":" << lineno << ": " << (line.c_str() + prefixlen) << "\n";
} else if (sscanf(line.c_str(), "%d(%d) : %n", &fileno, &lineno, &prefixlen) == 2
&& prefixlen > 0) {
// This is the format NVIDIA uses.
Filename fn = _shader->get_filename_from_index(fileno, type);
GLCAT.error(false)
<< fn << "(" << lineno << ") : " << (line.c_str() + prefixlen) << "\n";
} else if (sscanf(line.c_str(), "%d:%d(%d): %n", &fileno, &lineno, &colno, &prefixlen) == 3
&& prefixlen > 0) {
// This is the format for Mesa's OpenGL ES 2 implementation.
Filename fn = _shader->get_filename_from_index(fileno, type);
GLCAT.error(false)
<< fn << ":" << lineno << "(" << colno << "): " << (line.c_str() + prefixlen) << "\n";
} else if (!fatal) {
GLCAT.warning(false) << line << "\n";

View File

@ -375,7 +375,7 @@ make_writer(ostream *file, bool owns_file, const Filename &filename,
delete file;
}
if (!writer->is_valid()) {
if (writer != NULL && !writer->is_valid()) {
delete writer;
writer = NULL;
}

View File

@ -81,10 +81,12 @@ begin_frame(FrameMode mode, Thread *current_thread) {
return false;
}
if (_fb_properties.is_single_buffered()) {
wglgsg->_wglReleaseTexImageARB(_pbuffer, WGL_FRONT_LEFT_ARB);
} else {
wglgsg->_wglReleaseTexImageARB(_pbuffer, WGL_BACK_LEFT_ARB);
if (_pbuffer_bound) {
if (_fb_properties.is_single_buffered()) {
wglgsg->_wglReleaseTexImageARB(_pbuffer, WGL_FRONT_LEFT_ARB);
} else {
wglgsg->_wglReleaseTexImageARB(_pbuffer, WGL_BACK_LEFT_ARB);
}
}
if (!rebuild_bitplanes()) {
@ -158,7 +160,7 @@ bind_texture_to_pbuffer() {
for (size_t i = 0; i != cdata->_textures.size(); ++i) {
const RenderTexture &rt = cdata->_textures[i];
RenderTexturePlane plane = rt._plane;
if (plane == RTP_color) {
if (plane == RTP_color && rt._rtm_mode == RTM_bind_or_copy) {
tex_index = i;
break;
}