diff --git a/panda/src/gobj/textureReloadRequest.cxx b/panda/src/gobj/textureReloadRequest.cxx index b63acb6090..af6454c33a 100644 --- a/panda/src/gobj/textureReloadRequest.cxx +++ b/panda/src/gobj/textureReloadRequest.cxx @@ -22,28 +22,34 @@ TypeHandle TextureReloadRequest::_type_handle; AsyncTask::DoneStatus TextureReloadRequest:: do_task() { // Don't reload the texture if it doesn't need it. - if (_texture->was_image_modified(_pgo)) { - double delay = async_load_delay; - if (delay != 0.0) { - Thread::sleep(delay); - } + if (!_texture->was_image_modified(_pgo) && + (_allow_compressed ? _texture->has_ram_image() : _texture->has_uncompressed_ram_image())) { + return DS_done; + } - if (_texture->was_image_modified(_pgo)) { - if (_allow_compressed) { - _texture->get_ram_image(); - } else { - _texture->get_uncompressed_ram_image(); - } + double delay = async_load_delay; + if (delay != 0.0) { + Thread::sleep(delay); - // Now that we've loaded the texture, we should ensure it actually gets - // prepared--even if it's no longer visible in the frame--or it may - // become a kind of a leak (if the texture is never rendered again on - // this GSG, we'll just end up carrying the texture memory in RAM - // forever, instead of dumping it as soon as it gets prepared). - _pgo->enqueue_texture(_texture); + if (!_texture->was_image_modified(_pgo) && + (_allow_compressed ? _texture->has_ram_image() : _texture->has_uncompressed_ram_image())) { + return DS_done; } } + if (_allow_compressed) { + _texture->get_ram_image(); + } else { + _texture->get_uncompressed_ram_image(); + } + + // Now that we've loaded the texture, we should ensure it actually gets + // prepared--even if it's no longer visible in the frame--or it may become a + // kind of a leak (if the texture is never rendered again on this GSG, we'll + // just end up carrying the texture memory in RAM forever, instead of dumping + // it as soon as it gets prepared). + _pgo->enqueue_texture(_texture); + // Don't continue the task; we're done. return DS_done; }