better respect for keep-texture-ram and preload-textures in the presence of a bam-cache
This commit is contained in:
parent
2719a277e5
commit
5abe3a9e1c
|
|
@ -2392,7 +2392,9 @@ reload_ram_image() {
|
|||
gobj_cat.info()
|
||||
<< "Texture " << get_name() << " reloaded from disk cache.\n";
|
||||
PT(Texture) tex = DCAST(Texture, record->extract_data());
|
||||
bool keep_ram_image = _keep_ram_image;
|
||||
(*this) = (*tex);
|
||||
_keep_ram_image = keep_ram_image;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,6 +282,11 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
|
|||
gobj_cat.info()
|
||||
<< "Texture " << filename << " found in disk cache.\n";
|
||||
tex = DCAST(Texture, record->extract_data());
|
||||
if (!preload_textures) {
|
||||
// But drop the RAM until we need it.
|
||||
tex->clear_ram_image();
|
||||
}
|
||||
tex->set_keep_ram_image(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -329,6 +334,11 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
|
|||
// Store the on-disk cache record for next time.
|
||||
record->set_data(tex, false);
|
||||
cache->store(record);
|
||||
|
||||
if (!preload_textures) {
|
||||
// And now drop the RAM until we need it.
|
||||
tex->clear_ram_image();
|
||||
}
|
||||
}
|
||||
|
||||
nassertr(!tex->get_fullpath().empty(), tex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue