summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-03-19 13:21:52 -0400
committerLoren Shih <seraph@lindenlab.com>2010-03-19 13:21:52 -0400
commita3a430651780f82afb0fd355a0abe11d88f410d6 (patch)
treea2ec3b87b2bff75904be0e7a6bf38d17c59edb68 /indra/llrender/llrender.cpp
parentb952a5e5851d1a8bc2a45f00248b051497fec71f (diff)
parentf50be64167c254e27f635ad47d8940551f0c6ab4 (diff)
automated merge viewer2.0->viewer2.0
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 656f690db5..c3540a717c 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -121,6 +121,8 @@ void LLTexUnit::refreshState(void)
// We set dirty to true so that the tex unit knows to ignore caching
// and we reset the cached tex unit state
+ gGL.flush();
+
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
if (mCurrTexType != TT_NONE)
{
@@ -150,6 +152,7 @@ void LLTexUnit::activate(void)
if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
{
+ gGL.flush();
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
gGL.mCurrTextureUnitIndex = mIndex;
}
@@ -181,6 +184,7 @@ void LLTexUnit::disable(void)
{
activate();
unbind(mCurrTexType);
+ gGL.flush();
glDisable(sGLTextureType[mCurrTexType]);
mCurrTexType = TT_NONE;
}
@@ -386,6 +390,8 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)
{
if (mIndex < 0 || mCurrTexture == 0) return;
+ gGL.flush();
+
activate();
glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]);
@@ -400,6 +406,8 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio
{
if (mIndex < 0 || mCurrTexture == 0) return;
+ gGL.flush();
+
if (option == TFO_POINT)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -567,6 +575,7 @@ void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eT
if (mCurrBlendType != TB_COMBINE || gGL.mDirty)
{
mCurrBlendType = TB_COMBINE;
+ gGL.flush();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
}
@@ -577,6 +586,8 @@ void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eT
return;
}
+ gGL.flush();
+
// Get the gl source enums according to the eTextureBlendSrc sources passed in
GLint source1 = getTextureSource(src1);
GLint source2 = getTextureSource(src2);
@@ -709,6 +720,7 @@ void LLTexUnit::setColorScale(S32 scale)
if (mCurrColorScale != scale || gGL.mDirty)
{
mCurrColorScale = scale;
+ gGL.flush();
glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale );
}
}
@@ -718,6 +730,7 @@ void LLTexUnit::setAlphaScale(S32 scale)
if (mCurrAlphaScale != scale || gGL.mDirty)
{
mCurrAlphaScale = scale;
+ gGL.flush();
glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale );
}
}
@@ -853,7 +866,15 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z)
void LLRender::pushUIMatrix()
{
- mUIOffset.push_front(mUIOffset.front());
+ if (mUIOffset.empty())
+ {
+ mUIOffset.push_front(LLVector3(0,0,0));
+ }
+ else
+ {
+ mUIOffset.push_front(mUIOffset.front());
+ }
+
if (mUIScale.empty())
{
mUIScale.push_front(LLVector3(1,1,1));
@@ -1105,6 +1126,33 @@ void LLRender::flush()
sUICalls++;
sUIVerts += mCount;
}
+
+ if (gDebugGL)
+ {
+ if (mMode == LLRender::QUADS)
+ {
+ if (mCount%4 != 0)
+ {
+ llerrs << "Incomplete quad rendered." << llendl;
+ }
+ }
+
+ if (mMode == LLRender::TRIANGLES)
+ {
+ if (mCount%3 != 0)
+ {
+ llerrs << "Incomplete triangle rendered." << llendl;
+ }
+ }
+
+ if (mMode == LLRender::LINES)
+ {
+ if (mCount%2 != 0)
+ {
+ llerrs << "Incomplete line rendered." << llendl;
+ }
+ }
+ }
mBuffer->setBuffer(immediate_mask);
mBuffer->drawArrays(mMode, 0, mCount);