prevent overactive texture reload

This commit is contained in:
David Rose 2009-02-05 00:58:09 +00:00
parent 05917ee0b4
commit ec408822c5
2 changed files with 14 additions and 3 deletions

View File

@ -700,7 +700,10 @@ render_frame() {
// were drawn in the previous frame. // were drawn in the previous frame.
LoadedTextures::iterator lti; LoadedTextures::iterator lti;
for (lti = _loaded_textures.begin(); lti != _loaded_textures.end(); ++lti) { for (lti = _loaded_textures.begin(); lti != _loaded_textures.end(); ++lti) {
(*lti)->texture_uploaded(); LoadedTexture &lt = (*lti);
if (lt._tex->get_image_modified() == lt._image_modified) {
lt._tex->texture_uploaded();
}
} }
_loaded_textures.clear(); _loaded_textures.clear();
@ -1081,7 +1084,10 @@ texture_uploaded(Texture *tex) {
// We defer this until the end of the frame; multiple GSG's might be // We defer this until the end of the frame; multiple GSG's might be
// rendering the texture within the same frame, and we don't want to // rendering the texture within the same frame, and we don't want to
// dump the texture image until they've all had a chance at it. // dump the texture image until they've all had a chance at it.
_loaded_textures.push_back(tex); _loaded_textures.push_back(LoadedTexture());
LoadedTexture &lt = _loaded_textures.back();
lt._tex = tex;
lt._image_modified = tex->get_image_modified();
} }

View File

@ -346,7 +346,12 @@ private:
bool _singular_warning_last_frame; bool _singular_warning_last_frame;
bool _singular_warning_this_frame; bool _singular_warning_this_frame;
typedef pvector< PT(Texture) > LoadedTextures; class LoadedTexture {
public:
PT(Texture) _tex;
UpdateSeq _image_modified;
};
typedef pvector<LoadedTexture> LoadedTextures;
LoadedTextures _loaded_textures; LoadedTextures _loaded_textures;
LightReMutex _lock; LightReMutex _lock;