diff --git a/direct/src/distributed/DistributedSmoothNodeBase.py b/direct/src/distributed/DistributedSmoothNodeBase.py index 47dfbf8b4e..faeda49115 100755 --- a/direct/src/distributed/DistributedSmoothNodeBase.py +++ b/direct/src/distributed/DistributedSmoothNodeBase.py @@ -3,6 +3,7 @@ from ClockDelta import * from direct.task import Task from direct.showbase.PythonUtil import randFloat, Enum +from panda3d.direct import CDistributedSmoothNodeBase class DummyTaskClass: def setDelay(self, blah): diff --git a/panda/src/display/frameBufferProperties.cxx b/panda/src/display/frameBufferProperties.cxx index 06b7330535..01928f75b7 100644 --- a/panda/src/display/frameBufferProperties.cxx +++ b/panda/src/display/frameBufferProperties.cxx @@ -720,7 +720,7 @@ setup_color_texture(Texture *tex) const { { 1, 1, 1, 1, 0, false, Texture::F_rgb }, { 1, 1, 1, 1, 1, false, Texture::F_rgba }, { 24, 8, 8, 8, 0, false, Texture::F_rgb8 }, - { 24, 8, 8, 8, 8, false, Texture::F_rgba8 }, + { 32, 8, 8, 8, 8, false, Texture::F_rgba8 }, { 16, 16, 0, 0, 0, true, Texture::F_r16 }, { 32, 16, 16, 0, 0, true, Texture::F_rg16 }, { 32, 11, 11, 10, 0, true, Texture::F_r11_g11_b10 }, diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 67e60fc1ef..8b19191028 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -11099,9 +11099,13 @@ apply_sampler(GLuint unit, const SamplerState &sampler, CLP(TextureContext) *gtc } } - if (sampler.uses_mipmaps() && !gtc->_uses_mipmaps) { + if (sampler.uses_mipmaps() && !gtc->_uses_mipmaps && !gl_ignore_mipmaps) { // The texture wasn't created with mipmaps, but we are trying // to sample it with mipmaps. We will need to reload it. + GLCAT.info() + << "reloading texture " << gtc->get_texture()->get_name() + << " with mipmaps\n"; + apply_texture(gtc); gtc->mark_needs_reload(); bool okflag = upload_texture(gtc, false, true); diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 580b521241..c0ae51c523 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -510,15 +510,15 @@ estimate_texture_memory() const { case Texture::F_luminance_alpha: case Texture::F_luminance_alphamask: case Texture::F_sluminance_alpha: + case Texture::F_rgba4: + case Texture::F_rgb5: + case Texture::F_rgba5: bpp = 2; break; case Texture::F_rgba: - case Texture::F_rgba4: case Texture::F_rgbm: case Texture::F_rgb: - case Texture::F_rgb5: - case Texture::F_rgba5: case Texture::F_srgb: // Most of the above formats have only 3 bytes, but they are most likely to // get padded by the driver diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index d4c683f7ad..e7bd9d80c7 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -4465,6 +4465,9 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { set_fancy_bit(FB_effects, !_effects->is_empty()); set_fancy_bit(FB_tag, !_tag_data.empty()); + // Mark the bounds stale. + ++_next_update; + return pi; } diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index 9ae84b5deb..21fa7dfa74 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -142,6 +142,12 @@ init() { _file_stdfloat_double = scan.get_bool(); } + if (scan.get_current_index() > header.get_length()) { + bam_cat.error() + << "Bam header is too short.\n"; + return false; + } + return true; } @@ -1238,6 +1244,12 @@ p_read_object() { int object_id = read_object_id(scan); + if (scan.get_current_index() > dg.get_length()) { + bam_cat.error() + << "Found truncated datagram in bam stream\n"; + return 0; + } + // There are two cases (not counting the special _remove_flag case, // above). Either this is a new object definition, or this is a // reference to an object that was previously defined. @@ -1279,6 +1291,12 @@ p_read_object() { created_obj._ptr->fillin(scan, this); _now_creating = was_creating; + if (scan.get_remaining_size() > 0) { + bam_cat.warning() + << "Skipping " << scan.get_remaining_size() << " remaining bytes " + << "in datagram containing type " << type << "\n"; + } + } else { // We are receiving a new object. Now we can call the factory // to create the object. @@ -1379,6 +1397,13 @@ p_read_object() { } } } + + // Sanity check that we read the expected number of bytes. + if (scan.get_current_index() > dg.get_length()) { + bam_cat.error() + << "End of datagram reached while reading bam object " + << type << ": " << (void *)created_obj._ptr << "\n"; + } } return object_id; diff --git a/panda/src/putil/bamReader.h b/panda/src/putil/bamReader.h index 60dd47a3dc..dba9a1170b 100644 --- a/panda/src/putil/bamReader.h +++ b/panda/src/putil/bamReader.h @@ -144,8 +144,8 @@ PUBLISHED: INLINE const LoaderOptions &get_loader_options() const; INLINE void set_loader_options(const LoaderOptions &options); - TypedWritable *read_object(); - bool read_object(TypedWritable *&ptr, ReferenceCount *&ref_ptr); + BLOCKING TypedWritable *read_object(); + BLOCKING bool read_object(TypedWritable *&ptr, ReferenceCount *&ref_ptr); INLINE bool is_eof() const; bool resolve();