diff options
| -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/llrender/llshadermgr.cpp | 39 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl | 4 | ||||
| -rw-r--r-- | indra/newview/lldrawable.cpp | 3 | ||||
| -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/llface.cpp | 11 | ||||
| -rwxr-xr-x | indra/newview/lltexturefetch.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llviewertexture.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llvosurfacepatch.cpp | 4 | 
15 files changed, 73 insertions, 38 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/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 3fbf34296f..b6a9a6b653 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -702,7 +702,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade  		if (texture_index_channels > 1)  		{ -			text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n"); +			text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n");  		}  		text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); @@ -716,20 +716,33 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade  		}  		else if (major_version > 1 || minor_version >= 30)  		{  //switches are supported in GLSL 1.30 and later -			text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n"); -			text[count++] = strdup("\tswitch (vary_texture_index.r)\n"); -			text[count++] = strdup("\t{\n"); -		 -			//switch body -			for (S32 i = 0; i < texture_index_channels; ++i) -			{ -				std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i); -				text[count++] = strdup(case_str.c_str()); +			if (gGLManager.mIsNVIDIA) +			{ //switches are unreliable on some NVIDIA drivers +				for (U32 i = 0; i < texture_index_channels; ++i) +				{ +					std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);  +					text[count++] = strdup(if_string.c_str()); +				} +				text[count++] = strdup("\treturn vec4(1,0,1,1);\n"); +				text[count++] = strdup("}\n");  			} +			else +			{ +				text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n"); +				text[count++] = strdup("\tswitch (vary_texture_index)\n"); +				text[count++] = strdup("\t{\n"); +		 +				//switch body +				for (S32 i = 0; i < texture_index_channels; ++i) +				{ +					std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i); +					text[count++] = strdup(case_str.c_str()); +				} -			text[count++] = strdup("\t}\n"); -			text[count++] = strdup("\treturn ret;\n"); -			text[count++] = strdup("}\n"); +				text[count++] = strdup("\t}\n"); +				text[count++] = strdup("\treturn ret;\n"); +				text[count++] = strdup("}\n"); +			}  		}  		else  		{ //should never get here.  Indexed texture rendering requires GLSL 1.30 or later  diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 0092df6587..fd106ab79b 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1326,7 +1326,7 @@ void LLVertexBuffer::setupVertexArray()  		1, //TYPE_WEIGHT,  		4, //TYPE_WEIGHT4,  		4, //TYPE_CLOTHWEIGHT, -		4, //TYPE_TEXTURE_INDEX +		1, //TYPE_TEXTURE_INDEX  	};  	U32 attrib_type[] = @@ -1343,7 +1343,7 @@ void LLVertexBuffer::setupVertexArray()  		GL_FLOAT, //TYPE_WEIGHT,  		GL_FLOAT, //TYPE_WEIGHT4,  		GL_FLOAT, //TYPE_CLOTHWEIGHT, -		GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX +		GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX  	};  	bool attrib_integer[] =  @@ -2400,7 +2400,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)  #if !LL_DARWIN  			S32 loc = TYPE_TEXTURE_INDEX;  			void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12); -			glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); +			glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);  #endif  		}  		if (data_mask & MAP_VERTEX) diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl index 7c0699d72f..ca29bf3143 100644 --- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl @@ -23,9 +23,9 @@   * $/LicenseInfo$   */ -ATTRIBUTE ivec4 texture_index; +ATTRIBUTE int texture_index; -VARYING_FLAT ivec4 vary_texture_index; +VARYING_FLAT int vary_texture_index;  void passTextureIndex()  { diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 82ea5cd5a6..4eda2b92b3 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -625,8 +625,6 @@ BOOL LLDrawable::updateMove()  		return FALSE;  	} -	makeActive(); -	  	BOOL done;  	if (isState(MOVE_UNDAMPED)) @@ -635,6 +633,7 @@ BOOL LLDrawable::updateMove()  	}  	else  	{ +		makeActive();  		done = updateMoveDamped();  	}  	return done; 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/llface.cpp b/indra/newview/llface.cpp index f5b217d539..4b107ae151 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1943,15 +1943,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,  			LLVector4a texIdx; -			U8 index = mTextureIndex < 255 ? mTextureIndex : 0; +			S32 index = mTextureIndex < 255 ? mTextureIndex : 0;  			F32 val = 0.f; -			U8* vp = (U8*) &val; -			vp[0] = index; -			vp[1] = 0; -			vp[2] = 0; -			vp[3] = 0; - +			S32* vp = (S32*) &val; +			*vp = index; +			  			llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);  			LLVector4Logical mask; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7e6dfbc9d9..2ed7488b85 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1249,6 +1249,12 @@ bool LLTextureFetchWorker::doWork(S32 param)  				S32 max_attempts;  				if (mGetStatus == HTTP_NOT_FOUND)  				{ +					if(mWriteToCacheState == NOT_WRITE) //map tiles +					{ +						mState = DONE; +						return true; // failed, means no map tile on the empty region. +					} +  					mHTTPFailCount = max_attempts = 1; // Don't retry  					llwarns << "Texture missing from server (404): " << mUrl << llendl; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f5a3681437..b52c9d0d4b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -782,7 +782,13 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)  	}  	LLDrawable* old_parent = mDrawable->mParent;  	mDrawable->mParent = parentp;  -		 +	 +	if (parentp && mDrawable->isActive()) +	{ +		parentp->makeActive(); +		parentp->setState(LLDrawable::ACTIVE_CHILD); +	} +  	gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);  	if(	(old_parent != parentp && old_parent)  		|| (parentp && parentp->isActive())) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 7f638a24bf..e1eb54bd24 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2182,7 +2182,8 @@ void LLViewerFetchedTexture::setIsMissingAsset()  	}  	else  	{ -		llwarns << mUrl << ": Marking image as missing" << llendl; +		//it is normal no map tile on an empty region. +		//llwarns << mUrl << ": Marking image as missing" << llendl;  	}  	if (mHasFetcher)  	{ 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) | 
