LLRender's vertexbuffer created via init now, instead of ctor. Allows deallocation/reallocation.

This commit is contained in:
Shyotl
2011-10-08 02:58:23 -05:00
parent 418d80197e
commit 5e829b7a3a
3 changed files with 15 additions and 7 deletions

View File

@@ -934,13 +934,7 @@ LLRender::LLRender()
mMode(LLRender::TRIANGLES),
mCurrTextureUnitIndex(0),
mMaxAnisotropy(0.f)
{
mBuffer = new LLVertexBuffer(immediate_mask, 0);
mBuffer->allocateBuffer(4096, 0, TRUE);
mBuffer->getVertexStrider(mVerticesp);
mBuffer->getTexCoord0Strider(mTexcoordsp);
mBuffer->getColorStrider(mColorsp);
{
mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS);
for (U32 i = 0; i < LL_NUM_TEXTURE_LAYERS; i++)
{
@@ -971,6 +965,17 @@ LLRender::~LLRender()
shutdown();
}
void LLRender::init()
{
llassert_always(mBuffer.isNull()) ;
mBuffer = new LLVertexBuffer(immediate_mask, 0);
mBuffer->allocateBuffer(4096, 0, TRUE);
mBuffer->getVertexStrider(mVerticesp);
mBuffer->getTexCoord0Strider(mTexcoordsp);
mBuffer->getColorStrider(mColorsp);
}
void LLRender::shutdown()
{
for (U32 i = 0; i < mTexUnits.size(); i++)
@@ -986,6 +991,7 @@ void LLRender::shutdown()
delete mLightState[i];
}
mLightState.clear();
mBuffer = NULL ;
}
void LLRender::refreshState(void)

View File

@@ -314,6 +314,7 @@ public:
LLRender();
~LLRender();
void init() ;
void shutdown();
// Refreshes renderer state to the cached values

View File

@@ -1689,6 +1689,7 @@ LLViewerWindow::LLViewerWindow(
}
LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable"));
LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
gGL.init() ;
if (LLFeatureManager::getInstance()->isSafe()
|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())