Merge with default
This commit is contained in:
parent
f476c864c7
commit
72324650cf
6 changed files with 30 additions and 7 deletions
|
@ -1488,7 +1488,10 @@ void CDriverGL::enableUsedTextureMemorySum (bool enable)
|
|||
H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum )
|
||||
|
||||
if (enable)
|
||||
{
|
||||
nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL");
|
||||
_TextureUsed.reserve(512);
|
||||
}
|
||||
_SumTextureMemoryUsed=enable;
|
||||
}
|
||||
|
||||
|
@ -1502,7 +1505,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
|
|||
uint32 memory=0;
|
||||
|
||||
// For each texture used
|
||||
set<CTextureDrvInfosGL*>::const_iterator ite=_TextureUsed.begin();
|
||||
std::vector<CTextureDrvInfosGL *>::const_iterator ite = _TextureUsed.begin();
|
||||
while (ite!=_TextureUsed.end())
|
||||
{
|
||||
// Get the gl texture
|
||||
|
@ -1510,7 +1513,8 @@ uint32 CDriverGL::getUsedTextureMemory() const
|
|||
gltext= (*ite);
|
||||
|
||||
// Sum the memory used by this texture
|
||||
memory+=gltext->TextureMemory;
|
||||
if (gltext)
|
||||
memory+=gltext->TextureMemory;
|
||||
|
||||
// Next texture
|
||||
ite++;
|
||||
|
|
|
@ -196,6 +196,8 @@ public:
|
|||
|
||||
bool initFrameBufferObject(ITexture * tex);
|
||||
bool activeFrameBufferObject(ITexture * tex);
|
||||
|
||||
std::vector<CTextureDrvInfosGL *>::size_type TextureUsedIdx;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1273,7 +1275,7 @@ private:
|
|||
uint32 _NbSetupMaterialCall;
|
||||
uint32 _NbSetupModelMatrixCall;
|
||||
bool _SumTextureMemoryUsed;
|
||||
std::set<CTextureDrvInfosGL*> _TextureUsed;
|
||||
std::vector<CTextureDrvInfosGL *> _TextureUsed;
|
||||
uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const;
|
||||
|
||||
// VBHard Lock Profiling
|
||||
|
|
|
@ -79,6 +79,8 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri
|
|||
InitFBO = false;
|
||||
AttachDepthStencil = true;
|
||||
UsePackedDepthStencil = drvGl->supportPackedDepthStencil();
|
||||
|
||||
TextureUsedIdx = 0;
|
||||
}
|
||||
// ***************************************************************************
|
||||
CTextureDrvInfosGL::~CTextureDrvInfosGL()
|
||||
|
@ -91,7 +93,10 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
|
|||
_Driver->_AllocatedTextureMemory-= TextureMemory;
|
||||
|
||||
// release in TextureUsed.
|
||||
_Driver->_TextureUsed.erase (this);
|
||||
if (TextureUsedIdx < _Driver->_TextureUsed.size() && _Driver->_TextureUsed[TextureUsedIdx] == this)
|
||||
{
|
||||
_Driver->_TextureUsed[TextureUsedIdx] = NULL;
|
||||
}
|
||||
|
||||
if(InitFBO)
|
||||
{
|
||||
|
@ -1492,7 +1497,11 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
|||
if (_SumTextureMemoryUsed)
|
||||
{
|
||||
// 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())
|
||||
|
|
|
@ -28,10 +28,12 @@
|
|||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
|
||||
|
||||
void force_link_dbgroup_combo_box_cpp() { }
|
||||
|
||||
// Compare strings
|
||||
static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace NLGUI
|
|||
{
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
|
||||
|
||||
void force_link_dbgroup_select_number_cpp() { }
|
||||
|
||||
// ***************************************************************************
|
||||
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m) :
|
||||
CInterfaceGroup(param)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
namespace NLGUI
|
||||
{
|
||||
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
|
||||
void LinkHack()
|
||||
|
@ -33,5 +35,7 @@ namespace NLGUI
|
|||
CDBViewQuantity::forceLink();
|
||||
CViewPointer::forceLink();
|
||||
ifexprufct_forcelink();
|
||||
force_link_dbgroup_select_number_cpp();
|
||||
force_link_dbgroup_combo_box_cpp();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue