Merge remote-tracking branch 'shyotl/master'

This commit is contained in:
Latif Khalifa
2013-04-01 14:44:07 +02:00
10 changed files with 47 additions and 8 deletions

View File

@@ -2076,7 +2076,8 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
{
if (skin.has("joint_names"))
{
for (U32 i = 0; i < (U32)skin["joint_names"].size(); ++i)
const U32 joint_count = llmin((U32)skin["joint_names"].size(),(U32)64);
for (U32 i = 0; i < joint_count; ++i)
{
mJointNames.push_back(skin["joint_names"][i]);
}

View File

@@ -1023,6 +1023,7 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
}
}
LLRender::eBlendFactor blendfunc_debug[4]={LLRender::BF_UNDEF};
LLRender::LLRender()
: mDirty(false),
mCount(0),
@@ -1683,6 +1684,14 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
}
}
void check_blend_funcs()
{
llassert_always(blendfunc_debug[0] == LLRender::BF_SOURCE_ALPHA );
llassert_always(blendfunc_debug[1] == LLRender::BF_SOURCE_ALPHA );
llassert_always(blendfunc_debug[2] == LLRender::BF_ONE_MINUS_SOURCE_ALPHA );
llassert_always(blendfunc_debug[3] == LLRender::BF_ONE_MINUS_SOURCE_ALPHA );
}
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
{
llassert(sfactor < BF_UNDEF);
@@ -1694,6 +1703,8 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
mCurrBlendAlphaSFactor = sfactor;
mCurrBlendColorDFactor = dfactor;
mCurrBlendAlphaDFactor = dfactor;
blendfunc_debug[0]=blendfunc_debug[1]=sfactor;
blendfunc_debug[2]=blendfunc_debug[3]=dfactor;
flush();
glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]);
}
@@ -1719,6 +1730,8 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
mCurrBlendAlphaSFactor = alpha_sfactor;
mCurrBlendColorDFactor = color_dfactor;
mCurrBlendAlphaDFactor = alpha_dfactor;
blendfunc_debug[0]=blendfunc_debug[2]=color_sfactor;
blendfunc_debug[1]=blendfunc_debug[3]=alpha_sfactor;
flush();
glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);

View File

@@ -1152,6 +1152,7 @@ void LLView::draw()
drawChildren();
}
extern void check_blend_funcs();
void LLView::drawChildren()
{
@@ -1186,7 +1187,9 @@ void LLView::drawChildren()
LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
// flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
viewp->mInDraw = true;
if(gDebugGL)check_blend_funcs();
viewp->draw();
if(gDebugGL)check_blend_funcs();
viewp->mInDraw = false;
if (sDebugRects)
@@ -1293,7 +1296,9 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
LLUI::pushMatrix();
{
LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f);
if(gDebugGL)check_blend_funcs();
childp->draw();
if(gDebugGL)check_blend_funcs();
}
LLUI::popMatrix();
}

View File

@@ -351,6 +351,7 @@ void LLDrawPoolAlpha::render(S32 pass)
gHighlightProgram.unbind();
}
}
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)

View File

@@ -1349,10 +1349,12 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL;
//build matrix palette
LLMatrix4a mp[64];
static const size_t kMaxJoints = 64;
LLMatrix4a mp[kMaxJoints];
LLMatrix4* mat = (LLMatrix4*) mp;
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints);
for (U32 j = 0; j < maxJoints; ++j)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
if (joint)
@@ -1480,9 +1482,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if (sShaderLevel > 0)
{ //upload matrix palette to shader
LLMatrix4 mat[64];
static const size_t kMaxJoints = 64;
LLMatrix4 mat[kMaxJoints];
for (U32 i = 0; i < skin->mJointNames.size(); ++i)
U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints);
for (U32 i = 0; i < maxJoints; ++i)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);
if (joint)
@@ -1495,7 +1499,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
stop_glerror();
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",
skin->mJointNames.size(),
maxJoints,
FALSE,
(GLfloat*) mat[0].mMatrix);
@@ -1639,6 +1643,7 @@ void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar)
LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
renderRigged(avatar, RIGGED_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.setColorMask(true, false);
}
}
@@ -1656,6 +1661,7 @@ void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar)
LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.setColorMask(true, false);
}
}

View File

@@ -215,10 +215,12 @@ void LLDrawPoolTerrain::render(S32 pass)
else if (gGLManager.mNumTextureUnits < 4)
{
renderFull2TU();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
else
{
renderFull4TU();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}

View File

@@ -1516,6 +1516,7 @@ void render_ui_3d()
stop_glerror();
}
extern void check_blend_funcs();
void render_ui_2d()
{
LLGLSUIDefault gls_ui;
@@ -1561,7 +1562,9 @@ void render_ui_2d()
gGL.popMatrix();
stop_glerror();
}
if(gDebugGL)check_blend_funcs();
gViewerWindow->draw();
if(gDebugGL)check_blend_funcs();
// reset current origin for font rendering, in case of tiling render
LLFontGL::sCurOrigin.set(0, 0);

View File

@@ -2334,6 +2334,7 @@ void LLViewerWindow::drawDebugText()
}
}
extern void check_blend_funcs();
void LLViewerWindow::draw()
{
@@ -2411,7 +2412,9 @@ void LLViewerWindow::draw()
// Draw all nested UI views.
// No translation needed, this view is glued to 0,0
if(gDebugGL)check_blend_funcs();
mRootView->draw();
if(gDebugGL)check_blend_funcs();
// Draw optional on-top-of-everyone view
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
@@ -2423,7 +2426,9 @@ void LLViewerWindow::draw()
gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix();
LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
if(gDebugGL)check_blend_funcs();
top_ctrl->draw();
if(gDebugGL)check_blend_funcs();
LLUI::popMatrix();
}

View File

@@ -3252,7 +3252,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
line.replace(index, 2, firstnameText);
while ((index = line.find("%l")) != std::string::npos)
{
llinfos << "'" << line.substr(index) << "'" << llendl;
//llinfos << "'" << line.substr(index) << "'" << llendl;
if(lastnameText.empty() && line[index+2] == ' ') //Entire displayname string crammed into firstname
line.replace(index, 3, ""); //so eat the extra space.
else

View File

@@ -3743,6 +3743,7 @@ void LLPipeline::renderHighlights()
//debug use
U32 LLPipeline::sCurRenderPoolType = 0 ;
extern void check_blend_funcs();
void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{
LLFastTimer t(FTM_RENDER_GEOMETRY);
@@ -3879,6 +3880,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
for( S32 i = 0; i < poolp->getNumPasses(); i++ )
{
LLVertexBuffer::unbind();
if(gDebugGL)check_blend_funcs();
poolp->beginRenderPass(i);
for (iter2 = iter1; iter2 != mPools.end(); iter2++)
{
@@ -3887,10 +3889,10 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{
break;
}
p->render(i);
}
poolp->endRenderPass(i);
if(gDebugGL)check_blend_funcs();
LLVertexBuffer::unbind();
if (gDebugGL)
{
@@ -7892,6 +7894,7 @@ void LLPipeline::renderDeferredLighting()
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
gGL.setColorMask(true, true);