mirror of
https://github.com/glest/glest-source.git
synced 2025-08-14 04:13:58 +02:00
- added the ability to track pixmap memory usage at start and end of a game
This commit is contained in:
@@ -135,7 +135,7 @@ Game::~Game() {
|
|||||||
|
|
||||||
Unit::setGame(NULL);
|
Unit::setGame(NULL);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ==== END GAME ==== getCurrentPixelByteCount() = %llu\n",__FILE__,__FUNCTION__,__LINE__,(long long unsigned int)renderer.getCurrentPixelByteCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Game::quitTriggered() {
|
bool Game::quitTriggered() {
|
||||||
@@ -640,7 +640,7 @@ void Game::init(bool initForPreviewOnly)
|
|||||||
SystemFlags::OutputDebug(SystemFlags::debugPathFinder,"================ STARTING GAME ================\n");
|
SystemFlags::OutputDebug(SystemFlags::debugPathFinder,"================ STARTING GAME ================\n");
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugPathFinder,"PathFinderType: %s\n", (getGameSettings()->getPathFinderType() ? "RoutePlanner" : "PathFinder"));
|
SystemFlags::OutputDebug(SystemFlags::debugPathFinder,"PathFinderType: %s\n", (getGameSettings()->getPathFinderType() ? "RoutePlanner" : "PathFinder"));
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ==== START GAME ==== getCurrentPixelByteCount() = %llu\n",__FILE__,__FUNCTION__,__LINE__,(long long unsigned int)renderer.getCurrentPixelByteCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== update ====================
|
// ==================== update ====================
|
||||||
|
@@ -4214,5 +4214,20 @@ void Renderer::setLastRenderFps(int value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64 Renderer::getCurrentPixelByteCount(ResourceScope rs) const {
|
||||||
|
uint64 result = 0;
|
||||||
|
for(int i = (rs == rsCount ? 0 : rs); i < rsCount; ++i) {
|
||||||
|
const Shared::Graphics::TextureContainer &textures = textureManager[i]->getTextures();
|
||||||
|
for(int j = 0; j < textures.size(); ++j) {
|
||||||
|
const Texture *texture = textures[j];
|
||||||
|
result += texture->getPixelByteCount();
|
||||||
|
}
|
||||||
|
if(rs != rsCount) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -385,6 +385,8 @@ public:
|
|||||||
void removeObjectFromQuadCache(const Object *o);
|
void removeObjectFromQuadCache(const Object *o);
|
||||||
void removeUnitFromQuadCache(const Unit *unit);
|
void removeUnitFromQuadCache(const Unit *unit);
|
||||||
|
|
||||||
|
uint64 getCurrentPixelByteCount(ResourceScope rs=rsGame) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//private misc
|
//private misc
|
||||||
float computeSunAngle(float time);
|
float computeSunAngle(float time);
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using Shared::Platform::uint8;
|
using Shared::Platform::uint8;
|
||||||
|
using Shared::Platform::uint64;
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
@@ -81,6 +82,7 @@ public:
|
|||||||
virtual void end()=0;
|
virtual void end()=0;
|
||||||
virtual string getPath() const = 0;
|
virtual string getPath() const = 0;
|
||||||
virtual void deletePixels() = 0;
|
virtual void deletePixels() = 0;
|
||||||
|
virtual uint64 getPixelByteCount() const = 0;
|
||||||
|
|
||||||
virtual void reseInitState() { inited = false; }
|
virtual void reseInitState() { inited = false; }
|
||||||
|
|
||||||
@@ -104,6 +106,7 @@ public:
|
|||||||
const Pixmap1D *getPixmap() const {return &pixmap;}
|
const Pixmap1D *getPixmap() const {return &pixmap;}
|
||||||
virtual string getPath() const;
|
virtual string getPath() const;
|
||||||
virtual void deletePixels();
|
virtual void deletePixels();
|
||||||
|
virtual uint64 getPixelByteCount() const {return pixmap.getPixelByteCount();}
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -121,6 +124,7 @@ public:
|
|||||||
const Pixmap2D *getPixmap() const {return &pixmap;}
|
const Pixmap2D *getPixmap() const {return &pixmap;}
|
||||||
virtual string getPath() const;
|
virtual string getPath() const;
|
||||||
virtual void deletePixels();
|
virtual void deletePixels();
|
||||||
|
virtual uint64 getPixelByteCount() const {return pixmap.getPixelByteCount();}
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -138,6 +142,7 @@ public:
|
|||||||
const Pixmap3D *getPixmap() const {return &pixmap;}
|
const Pixmap3D *getPixmap() const {return &pixmap;}
|
||||||
virtual string getPath() const;
|
virtual string getPath() const;
|
||||||
virtual void deletePixels();
|
virtual void deletePixels();
|
||||||
|
virtual uint64 getPixelByteCount() const {return pixmap.getPixelByteCount();}
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -155,6 +160,7 @@ public:
|
|||||||
const PixmapCube *getPixmap() const {return &pixmap;}
|
const PixmapCube *getPixmap() const {return &pixmap;}
|
||||||
virtual string getPath() const;
|
virtual string getPath() const;
|
||||||
virtual void deletePixels();
|
virtual void deletePixels();
|
||||||
|
virtual uint64 getPixelByteCount() const {return pixmap.getPixelByteCount();}
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -23,11 +23,10 @@ namespace Shared{ namespace Graphics{
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
// class TextureManager
|
// class TextureManager
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
typedef vector<Texture*> TextureContainer;
|
||||||
|
|
||||||
//manages textures, creation on request and deletion on destruction
|
//manages textures, creation on request and deletion on destruction
|
||||||
class TextureManager{
|
class TextureManager{
|
||||||
protected:
|
|
||||||
typedef vector<Texture*> TextureContainer;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TextureContainer textures;
|
TextureContainer textures;
|
||||||
@@ -56,6 +55,8 @@ public:
|
|||||||
Texture2D *newTexture2D();
|
Texture2D *newTexture2D();
|
||||||
Texture3D *newTexture3D();
|
Texture3D *newTexture3D();
|
||||||
TextureCube *newTextureCube();
|
TextureCube *newTextureCube();
|
||||||
|
|
||||||
|
const TextureContainer &getTextures() const {return textures;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -81,6 +81,7 @@ void Mesh::end() {
|
|||||||
if(texturesOwned[i] == true && textures[i] != NULL) {
|
if(texturesOwned[i] == true && textures[i] != NULL) {
|
||||||
//printf("Deleting Texture [%s] i = %d\n",textures[i]->getPath().c_str(),i);
|
//printf("Deleting Texture [%s] i = %d\n",textures[i]->getPath().c_str(),i);
|
||||||
textureManager->endTexture(textures[i]);
|
textureManager->endTexture(textures[i]);
|
||||||
|
textures[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user