Batch indexing/no-fixed-function WIP.

This commit is contained in:
Shyotl
2011-08-09 01:11:05 -05:00
parent 1e7415095c
commit 9bda97786f
225 changed files with 2120 additions and 729 deletions

View File

@@ -324,6 +324,9 @@ void LLDrawPoolBump::endRenderPass(S32 pass)
llassert(0);
break;
}
//to cleanup texture channels
LLRenderPass::endRenderPass(pass);
}
//static
@@ -362,6 +365,11 @@ void LLDrawPoolBump::beginShiny(bool invisible)
}
bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible);
if (mVertexShaderLevel > 1)
{ //indexed texture rendering, channel 0 is always diffuse
diffuse_channel = 0;
}
}
//static
@@ -429,7 +437,7 @@ void LLDrawPoolBump::renderShiny(bool invisible)
LLGLEnable blend_enable(GL_BLEND);
if (!invisible && mVertexShaderLevel > 1)
{
LLRenderPass::renderTexture(LLRenderPass::PASS_SHINY, sVertexMask);
LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
}
else if (!invisible)
{
@@ -537,6 +545,12 @@ void LLDrawPoolBump::beginFullbrightShiny()
gGL.getTexUnit(cube_channel)->bind(cube_map);
gGL.getTexUnit(0)->activate();
}
if (mVertexShaderLevel > 1)
{ //indexed texture rendering, channel 0 is always diffuse
diffuse_channel = 0;
}
mShiny = TRUE;
}
@@ -551,7 +565,15 @@ void LLDrawPoolBump::renderFullbrightShiny()
if( gSky.mVOSkyp->getCubeMap() )
{
LLGLEnable blend_enable(GL_BLEND);
LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
if (mVertexShaderLevel > 1)
{
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
}
else
{
LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
}
}
}
@@ -845,6 +867,9 @@ void LLDrawPoolBump::endPostDeferredPass(S32 pass)
endBump(LLRenderPass::PASS_POST_BUMP);
break;
}
//to disable texture channels
LLRenderPass::endRenderPass(pass);
}
void LLDrawPoolBump::renderPostDeferred(S32 pass)
@@ -1304,43 +1329,59 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask)
}
}
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
{
applyModelMatrix(params);
if (params.mTextureMatrix)
bool tex_setup = false;
if (batch_textures && params.mTextureList.size() > 1)
{
if (mShiny)
for (U32 i = 0; i < params.mTextureList.size(); ++i)
{
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
if (params.mTextureList[i].notNull())
{
gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
}
}
else
}
else
{ //not batching textures or batch has only 1 texture -- might need a texture matrix
if (params.mTextureMatrix)
{
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
if (mShiny)
{
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
}
else
{
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
gGL.getTexUnit(0)->activate();
}
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
gGL.getTexUnit(0)->activate();
tex_setup = true;
}
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
}
if (mShiny && mVertexShaderLevel > 1 && texture)
{
if (params.mTexture.notNull())
if (mShiny && mVertexShaderLevel > 1 && texture)
{
gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
params.mTexture->addTextureStats(params.mVSize);
}
else
{
gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
if (params.mTexture.notNull())
{
gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
params.mTexture->addTextureStats(params.mVSize);
}
else
{
gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
}
}
}
if (params.mGroup)
{
params.mGroup->rebuildMesh();
@@ -1348,7 +1389,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
params.mVertexBuffer->setBuffer(mask);
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount/3);
if (params.mTextureMatrix)
if (tex_setup)
{
if (mShiny)
{