Merge with default

This commit is contained in:
Quitta 2013-07-31 16:26:22 +02:00
parent f476c864c7
commit 72324650cf
6 changed files with 30 additions and 7 deletions

View file

@ -1488,7 +1488,10 @@ void CDriverGL::enableUsedTextureMemorySum (bool enable)
H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum ) H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum )
if (enable) if (enable)
{
nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL"); nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL");
_TextureUsed.reserve(512);
}
_SumTextureMemoryUsed=enable; _SumTextureMemoryUsed=enable;
} }
@ -1502,7 +1505,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
uint32 memory=0; uint32 memory=0;
// For each texture used // For each texture used
set<CTextureDrvInfosGL*>::const_iterator ite=_TextureUsed.begin(); std::vector<CTextureDrvInfosGL *>::const_iterator ite = _TextureUsed.begin();
while (ite!=_TextureUsed.end()) while (ite!=_TextureUsed.end())
{ {
// Get the gl texture // Get the gl texture
@ -1510,6 +1513,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
gltext= (*ite); gltext= (*ite);
// Sum the memory used by this texture // Sum the memory used by this texture
if (gltext)
memory+=gltext->TextureMemory; memory+=gltext->TextureMemory;
// Next texture // Next texture

View file

@ -196,6 +196,8 @@ public:
bool initFrameBufferObject(ITexture * tex); bool initFrameBufferObject(ITexture * tex);
bool activeFrameBufferObject(ITexture * tex); bool activeFrameBufferObject(ITexture * tex);
std::vector<CTextureDrvInfosGL *>::size_type TextureUsedIdx;
}; };
@ -1273,7 +1275,7 @@ private:
uint32 _NbSetupMaterialCall; uint32 _NbSetupMaterialCall;
uint32 _NbSetupModelMatrixCall; uint32 _NbSetupModelMatrixCall;
bool _SumTextureMemoryUsed; bool _SumTextureMemoryUsed;
std::set<CTextureDrvInfosGL*> _TextureUsed; std::vector<CTextureDrvInfosGL *> _TextureUsed;
uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const; uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const;
// VBHard Lock Profiling // VBHard Lock Profiling

View file

@ -79,6 +79,8 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri
InitFBO = false; InitFBO = false;
AttachDepthStencil = true; AttachDepthStencil = true;
UsePackedDepthStencil = drvGl->supportPackedDepthStencil(); UsePackedDepthStencil = drvGl->supportPackedDepthStencil();
TextureUsedIdx = 0;
} }
// *************************************************************************** // ***************************************************************************
CTextureDrvInfosGL::~CTextureDrvInfosGL() CTextureDrvInfosGL::~CTextureDrvInfosGL()
@ -91,7 +93,10 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
_Driver->_AllocatedTextureMemory-= TextureMemory; _Driver->_AllocatedTextureMemory-= TextureMemory;
// release in TextureUsed. // release in TextureUsed.
_Driver->_TextureUsed.erase (this); if (TextureUsedIdx < _Driver->_TextureUsed.size() && _Driver->_TextureUsed[TextureUsedIdx] == this)
{
_Driver->_TextureUsed[TextureUsedIdx] = NULL;
}
if(InitFBO) if(InitFBO)
{ {
@ -1492,7 +1497,11 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
if (_SumTextureMemoryUsed) if (_SumTextureMemoryUsed)
{ {
// Insert the pointer of this texture // Insert the pointer of this texture
_TextureUsed.insert (gltext); if (gltext->TextureUsedIdx >= _TextureUsed.size() || _TextureUsed[gltext->TextureUsedIdx] != gltext)
{
gltext->TextureUsedIdx = _TextureUsed.size();
_TextureUsed.push_back(gltext);
}
} }
if(tex->isTextureCube()) if(tex->isTextureCube())

View file

@ -28,10 +28,12 @@
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
namespace NLGUI namespace NLGUI
{ {
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
void force_link_dbgroup_combo_box_cpp() { }
// Compare strings // Compare strings
static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2) static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2)
{ {

View file

@ -31,6 +31,8 @@ namespace NLGUI
{ {
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
void force_link_dbgroup_select_number_cpp() { }
// *************************************************************************** // ***************************************************************************
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam &param) : CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam &param) :
CInterfaceGroup(param) CInterfaceGroup(param)

View file

@ -24,6 +24,8 @@
namespace NLGUI namespace NLGUI
{ {
void ifexprufct_forcelink(); void ifexprufct_forcelink();
void force_link_dbgroup_select_number_cpp();
void force_link_dbgroup_combo_box_cpp();
/// Necessary so the linker doesn't drop the code of these classes from the library /// Necessary so the linker doesn't drop the code of these classes from the library
void LinkHack() void LinkHack()
@ -33,5 +35,7 @@ namespace NLGUI
CDBViewQuantity::forceLink(); CDBViewQuantity::forceLink();
CViewPointer::forceLink(); CViewPointer::forceLink();
ifexprufct_forcelink(); ifexprufct_forcelink();
force_link_dbgroup_select_number_cpp();
force_link_dbgroup_combo_box_cpp();
} }
} }