Batch indexing/no-fixed-function WIP.
This commit is contained in:
@@ -197,6 +197,15 @@ void LLDrawPool::renderPostDeferred(S32 pass)
|
||||
//virtual
|
||||
void LLDrawPool::endRenderPass( S32 pass )
|
||||
{
|
||||
for (U32 i = 0; i < (U32)gGLManager.mNumTextureImageUnits; i++)
|
||||
{ //dummy cleanup of any currently bound textures
|
||||
if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE)
|
||||
{
|
||||
gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType());
|
||||
gGL.getTexUnit(i)->disable();
|
||||
}
|
||||
}
|
||||
gGL.getTexUnit(0)->activate();
|
||||
}
|
||||
|
||||
//virtual
|
||||
@@ -441,14 +450,14 @@ void LLRenderPass::renderTexture(U32 type, U32 mask)
|
||||
pushBatches(type, mask, TRUE);
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture)
|
||||
void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
{
|
||||
for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)
|
||||
{
|
||||
LLDrawInfo* pparams = *i;
|
||||
if (pparams)
|
||||
{
|
||||
pushBatch(*pparams, mask, texture);
|
||||
pushBatch(*pparams, mask, texture, batch_textures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -467,7 +476,7 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
{
|
||||
applyModelMatrix(params);
|
||||
|
||||
@@ -475,21 +484,35 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
|
||||
|
||||
if (texture)
|
||||
{
|
||||
if (params.mTexture.notNull())
|
||||
if (batch_textures && params.mTextureList.size() > 1)
|
||||
{
|
||||
params.mTexture->addTextureStats(params.mVSize);
|
||||
gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
|
||||
if (params.mTextureMatrix)
|
||||
for (U32 i = 0; i < params.mTextureList.size(); ++i)
|
||||
{
|
||||
tex_setup = true;
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
|
||||
gPipeline.mTextureMatrixOps++;
|
||||
if (params.mTextureList[i].notNull())
|
||||
{
|
||||
gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
{ //not batching textures or batch has only 1 texture -- might need a texture matrix
|
||||
if (params.mTexture.notNull())
|
||||
{
|
||||
params.mTexture->addTextureStats(params.mVSize);
|
||||
gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
|
||||
if (params.mTextureMatrix)
|
||||
{
|
||||
tex_setup = true;
|
||||
gGL.getTexUnit(0)->activate();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
|
||||
gPipeline.mTextureMatrixOps++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user