diff options
| author | Dave Parks <davep@lindenlab.com> | 2012-07-03 14:35:08 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2012-07-03 14:35:08 -0500 | 
| commit | d1c056beba8c3558756eac816e26a388a512e0ee (patch) | |
| tree | c8ca81ad12200e6d8854f81658c1e809b050a1dd | |
| parent | 4c4a23226a2db8b1dac5b8d6b8f1537fc9164cf6 (diff) | |
MAINT-685 Fix for disabling basic shaders making high detail terrain render incorrectly.
| -rw-r--r-- | indra/llrender/llglstates.h | 5 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 13 | ||||
| -rw-r--r-- | indra/llrender/llrender.h | 1 | ||||
| -rw-r--r-- | indra/newview/lldrawpool.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/lldrawpoolterrain.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/lldrawpooltree.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llvosurfacepatch.cpp | 4 | 
7 files changed, 22 insertions, 9 deletions
| diff --git a/indra/llrender/llglstates.h b/indra/llrender/llglstates.h index e26aead676..0e2c3bcb44 100644 --- a/indra/llrender/llglstates.h +++ b/indra/llrender/llglstates.h @@ -59,7 +59,6 @@ protected:  	LLGLEnable mColorMaterial;  	LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog,   		mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, -		mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT,  		mGLMultisample;  public:  	LLGLSDefault() @@ -76,10 +75,6 @@ public:  		mLineStipple(GL_LINE_STIPPLE),  		mNormalize(GL_NORMALIZE),  		mPolygonSmooth(GL_POLYGON_SMOOTH), -		mTextureGenQ(GL_TEXTURE_GEN_Q),  -		mTextureGenR(GL_TEXTURE_GEN_R), -		mTextureGenS(GL_TEXTURE_GEN_S),  -		mTextureGenT(GL_TEXTURE_GEN_T),  		mGLMultisample(GL_MULTISAMPLE_ARB)  	{ }  }; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 348c1eb1b7..4597d06260 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -648,7 +648,7 @@ void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eT  		gGL.flush();  		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);  	} - +	  	// We want an early out, because this function does a LOT of stuff.  	if ( ( (isAlpha && (mCurrAlphaOp == op) && (mCurrAlphaSrc1 == src1) && (mCurrAlphaSrc2 == src2))  			|| (!isAlpha && (mCurrColorOp == op) && (mCurrColorSrc1 == src1) && (mCurrColorSrc2 == src2)) ) && !gGL.mDirty) @@ -1437,6 +1437,17 @@ void LLRender::matrixMode(U32 mode)  	mMatrixMode = mode;  } +U32 LLRender::getMatrixMode() +{ +	if (mMatrixMode >= MM_TEXTURE0 && mMatrixMode <= MM_TEXTURE3) +	{ //always return MM_TEXTURE if current matrix mode points at any texture matrix +		return MM_TEXTURE; +	} + +	return mMatrixMode; +} + +  void LLRender::loadIdentity()  {  	flush(); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index fa5f7f311d..78a310e525 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -346,6 +346,7 @@ public:  	void loadIdentity();  	void multMatrix(const GLfloat* m);  	void matrixMode(U32 mode);	 +	U32 getMatrixMode();  	const glh::matrix4f& getModelviewMatrix();  	const glh::matrix4f& getProjectionMatrix(); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 6c0be0a5c2..b8c143e9c1 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -418,6 +418,7 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)  		gGL.loadMatrix(gGLModelView);  		if (params.mModelMatrix)  		{ +			llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);  			gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);  		}  		gPipeline.mMatrixOpCount++; diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 7fc78fb382..9bc32fddbd 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -308,6 +308,7 @@ void LLDrawPoolTerrain::drawLoop()  			if (model_matrix != gGLLastMatrix)  			{ +				llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);  				gGLLastMatrix = model_matrix;  				gGL.loadMatrix(gGLModelView);  				if (model_matrix) @@ -594,7 +595,8 @@ void LLDrawPoolTerrain::renderFull4TU()  	gGL.matrixMode(LLRender::MM_TEXTURE);  	gGL.loadIdentity();  	gGL.translatef(-1.f, 0.f, 0.f); -   +	gGL.matrixMode(LLRender::MM_MODELVIEW); +  	// Set alpha texture and do lighting modulation  	gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);  	gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); @@ -742,6 +744,7 @@ void LLDrawPoolTerrain::renderFull2TU()  	gGL.matrixMode(LLRender::MM_TEXTURE);  	gGL.loadIdentity();  	gGL.translatef(-1.f, 0.f, 0.f); +	gGL.matrixMode(LLRender::MM_MODELVIEW);  	// Care about alpha only  	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); @@ -781,6 +784,7 @@ void LLDrawPoolTerrain::renderFull2TU()  	gGL.matrixMode(LLRender::MM_TEXTURE);  	gGL.loadIdentity();  	gGL.translatef(-2.f, 0.f, 0.f); +	gGL.matrixMode(LLRender::MM_MODELVIEW);  	// Care about alpha only  	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 83f04e45a8..fedbd782dc 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -116,6 +116,7 @@ void LLDrawPoolTree::render(S32 pass)  				gGL.loadMatrix(gGLModelView);  				if (model_matrix)  				{ +					llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);  					gGL.multMatrix((GLfloat*) model_matrix->mMatrix);  				}  				gPipeline.mMatrixOpCount++; diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 94a3111f4c..cb905d02da 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -80,9 +80,9 @@ public:  			glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));  		}  		if (data_mask & MAP_TEXCOORD3) -		{ //substitute tex coord 0 for tex coord 3 +		{ //substitute tex coord 1 for tex coord 3  			glClientActiveTextureARB(GL_TEXTURE3_ARB); -			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0])); +			glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));  			glClientActiveTextureARB(GL_TEXTURE0_ARB);  		}  		if (data_mask & MAP_TEXCOORD2) | 
