Commits

davep committed 3b02d5a Merge

merge

Comments (0)

Files changed (38)

indra/llplugin/llpluginmessagepipe.cpp

 LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
 	mInputMutex(gAPRPoolp),
 	mOutputMutex(gAPRPoolp),
+	mOutputStartIndex(0),
 	mOwner(owner),
 	mSocket(socket)
 {
-	
 	mOwner->setMessagePipe(this);
 }
 
 {
 	// queue the message for later output
 	LLMutexLock lock(&mOutputMutex);
+
+	// If we're starting to use up too much memory, clear
+	if (mOutputStartIndex > 1024 * 1024)
+	{
+		mOutput = mOutput.substr(mOutputStartIndex);
+		mOutputStartIndex = 0;
+	}
+		
 	mOutput += message;
 	mOutput += MESSAGE_DELIMITER;	// message separator
 	
 	if(mSocket)
 	{
 		apr_status_t status;
-		apr_size_t size;
+		apr_size_t in_size, out_size;
 		
 		LLMutexLock lock(&mOutputMutex);
-		if(!mOutput.empty())
+
+		const char * output_data = &(mOutput.data()[mOutputStartIndex]);
+		if(*output_data != '\0')
 		{
 			// write any outgoing messages
-			size = (apr_size_t)mOutput.size();
+			in_size = (apr_size_t) (mOutput.size() - mOutputStartIndex);
+			out_size = in_size;
 			
 			setSocketTimeout(0);
 			
 //			LL_INFOS("Plugin") << "before apr_socket_send, size = " << size << LL_ENDL;
 
-			status = apr_socket_send(
-					mSocket->getSocket(),
-					(const char*)mOutput.data(),
-					&size);
+			status = apr_socket_send(mSocket->getSocket(),
+									 output_data,
+									 &out_size);
 
 //			LL_INFOS("Plugin") << "after apr_socket_send, size = " << size << LL_ENDL;
 			
-			if(status == APR_SUCCESS)
+			if((status == APR_SUCCESS) || APR_STATUS_IS_EAGAIN(status))
 			{
-				// success
-				mOutput = mOutput.substr(size);
-			}
-			else if(APR_STATUS_IS_EAGAIN(status))
-			{
-				// Socket buffer is full... 
-				// remove the written part from the buffer and try again later.
-				mOutput = mOutput.substr(size);
+				// Success or Socket buffer is full... 
+				
+				// If we've pumped the entire string, clear it
+				if (out_size == in_size)
+				{
+					mOutputStartIndex = 0;
+					mOutput.clear();
+				}
+				else
+				{
+					llassert(in_size > out_size);
+					
+					// Remove the written part from the buffer and try again later.
+					mOutputStartIndex += out_size;
+				}
 			}
 			else if(APR_STATUS_IS_EOF(status))
 			{

indra/llplugin/llpluginmessagepipe.h

 	std::string mInput;
 	LLMutex mOutputMutex;
 	std::string mOutput;
+	std::string::size_type mOutputStartIndex;
 
 	LLPluginMessagePipeOwner *mOwner;
 	LLSocket::ptr_t mSocket;

indra/llprimitive/lltextureanim.cpp

 
 	mMode = data[0];
 	mFace = data[1];
-	mSizeX = llmax((U8)1, data[2]);
-	mSizeY = llmax((U8)1, data[3]);
+	mSizeX = data[2];
+	mSizeY = data[3];
 	htonmemcpy(&mStart, data + 4, MVT_F32, sizeof(F32));
 	htonmemcpy(&mLength, data + 8, MVT_F32, sizeof(F32));
 	htonmemcpy(&mRate, data + 12, MVT_F32, sizeof(F32));

indra/llrender/llshadermgr.cpp

 		LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL;
 	}
 
-// NOTE: Removing LL_DARWIN block as it doesn't seem to actually give the correct answer, 
-// but want it for reference once I move it.
-#if 0
-	// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
-	// per Apple's suggestion   
-	glBegin(gGL.mMode);
-	glEnd();
+#if LL_DARWIN
 
-	// Query whether the shader can or cannot run in hardware
-	// http://developer.apple.com/qa/qa2007/qa1502.html
-	long vertexGPUProcessing;
-	CGLContextObj ctx = CGLGetCurrentContext();
-	CGLGetParameter (ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);	
-	long fragmentGPUProcessing;
-	CGLGetParameter (ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
-	if (!fragmentGPUProcessing || !vertexGPUProcessing)
+	// For some reason this absolutely kills the frame rate when VBO's are enabled
+	if (0)
 	{
-		LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
-		success = GL_FALSE;
-		suppress_errors = FALSE;		
+		// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
+		// per Apple's suggestion
+		LLGLSLShader::sNoFixedFunction = false;
+		
+		glUseProgramObjectARB(obj);
+
+		gGL.begin(LLRender::TRIANGLES);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.vertex3f(0.0f, 0.0f, 0.0f);
+		gGL.end();
+		gGL.flush();
+		
+		glUseProgramObjectARB(0);
+		
+		LLGLSLShader::sNoFixedFunction = true;
+
+		// Query whether the shader can or cannot run in hardware
+		// http://developer.apple.com/qa/qa2007/qa1502.html
+		GLint vertexGPUProcessing, fragmentGPUProcessing;
+		CGLContextObj ctx = CGLGetCurrentContext();
+		CGLGetParameter(ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);	
+		CGLGetParameter(ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
+		if (!fragmentGPUProcessing || !vertexGPUProcessing)
+		{
+			LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
+			success = GL_FALSE;
+			suppress_errors = FALSE;		
+		}
 	}
-	
+
 #else
 	std::string log = get_object_log(obj);
 	LLStringUtil::toLower(log);

indra/llui/llscrolllistctrl.cpp

 	mBorder(NULL),
 	mSortCallback(NULL),
 	mPopupMenu(NULL),
+	mCommentTextView(NULL),
 	mNumDynamicWidthColumns(0),
 	mTotalStaticColumnWidth(0),
 	mTotalColumnPadding(0),
 		getRect().getWidth() - 2 * mBorderThickness,
 		getRect().getHeight() - (2 * mBorderThickness ) - heading_size );
 
-	getChildView("comment_text")->setShape(mItemListRect);
+	if (mCommentTextView == NULL)
+	{
+		mCommentTextView = getChildView("comment_text");
+	}
+
+	mCommentTextView->setShape(mItemListRect);
 
 	// how many lines of content in a single "page"
 	S32 page_lines =  getLinesPerPage();

indra/llui/llscrolllistctrl.h

 	S32				mHighlightedItem;
 	class LLViewBorder*	mBorder;
 	LLContextMenu	*mPopupMenu;
+	
+	LLView			*mCommentTextView;
 
 	LLWString		mSearchString;
 	LLFrameTimer	mSearchTimer;

indra/newview/app_settings/settings.xml

     <integer>0</integer>
   </map>
 
-  <key>RenderAnimateTrees</key>
-  <map>
-    <key>Comment</key>
-    <string>Use GL matrix ops to animate tree branches.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Boolean</string>
-    <key>Value</key>
-    <integer>0</integer>
-  </map>
-  
   <key>RenderMinimumLODTriangleCount</key>
   <map>
     <key>Comment</key>

indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl

 
 uniform mat4 inv_proj;
 
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
 void main() 
 {
 	vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;

indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl

 
 void main() 
 {
-	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a;
+	float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a;
 
 	if (alpha < minimum_alpha)
 	{

indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl

 VARYING vec4 vertex_color;
 VARYING vec2 vary_texcoord0;
 
+void passTextureIndex();
+
 void main()
 {
 	//transform vertex
 	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
-	
 	post_pos = pos;
 	
 	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
 	
+	passTextureIndex();
+
 	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	vertex_color = diffuse_color;
 }

indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl

 
 uniform mat4 inv_proj;
 
-vec4 getPosition(vec2 pos_screen)
-{
-	float depth = texture2DRect(depthMap, pos_screen.xy).a;
-	vec2 sc = pos_screen.xy*2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0,1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos.xyz /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
 float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
 {
 	stc.xyz /= stc.w;

indra/newview/featuretable_mac.txt

-version 31
+version 32
 // The version number above should be implemented IF AND ONLY IF some
 // change has been made that is sufficiently important to justify
 // resetting the graphics preferences of all users to the recommended
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
 WatchdogDisabled				1	1
-RenderUseStreamVBO			1	0
+RenderUseStreamVBO			1	1
 RenderFSAASamples			1	16
 RenderMaxTextureIndex		1	16
 

indra/newview/lldebugview.cpp

 static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
 
 LLDebugView::LLDebugView(const LLDebugView::Params& p)
-:	LLView(p)
+:	LLView(p),
+	mFastTimerView(NULL),
+	mMemoryView(NULL),
+	mDebugConsolep(NULL),
+	mFloaterSnapRegion(NULL)
 {}
 
+LLDebugView::~LLDebugView()
+{
+	// These have already been deleted.  Fix the globals appropriately.
+	gDebugView = NULL;
+	gTextureView = NULL;
+	gSceneView = NULL;
+	gTextureSizeView = NULL;
+	gTextureCategoryView = NULL;
+}
+
+BOOL LLDebugView::postBuild()
+{
+	mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region");
+	
+	return TRUE;
+}
+
 void LLDebugView::init()
 {
 	LLRect r;
 	addChild(gTextureView);
 	//gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
 
-	
-
 
 	if(gAuditTexture)
 	{
 	}
 }
 
-
-LLDebugView::~LLDebugView()
-{
-	// These have already been deleted.  Fix the globals appropriately.
-	gDebugView = NULL;
-	gTextureView = NULL;
-	gSceneView = NULL;
-	gTextureSizeView = NULL;
-	gTextureCategoryView = NULL;
-}
-
 void LLDebugView::draw()
 {
-	LLView* floater_snap_region = getRootView()->getChildView("floater_snap_region");
 	LLRect debug_rect;
-	floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &debug_rect, getParent());
+	mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &debug_rect, getParent());
 
 	setShape(debug_rect);
 	LLView::draw();

indra/newview/lldebugview.h

 			changeDefault(mouse_opaque, false);
 		}
 	};
+	
 	LLDebugView(const Params&);
 	~LLDebugView();
 
+	BOOL postBuild();
+	
 	void init();
 	void draw();
-
+	
 	void setStatsVisible(BOOL visible);
 	
 	LLFastTimerView* mFastTimerView;
 	LLMemoryView*	 mMemoryView;
 	LLConsole*		 mDebugConsolep;
+	LLView*			 mFloaterSnapRegion;
 };
 
 extern LLDebugView* gDebugView;

indra/newview/lldrawpool.h

 		PASS_ALPHA,
 		PASS_ALPHA_MASK,
 		PASS_FULLBRIGHT_ALPHA_MASK,
-		PASS_ALPHA_SHADOW,
 		NUM_RENDER_TYPES,
 	};
 

indra/newview/lldrawpooltree.cpp

 	LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
 	LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
 
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
+	gGL.getTexUnit(sDiffTex)->bind(mTexturep);
+				
+	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+		 iter != mDrawFace.end(); iter++)
 	{
-		renderTree();
-	}
-	else
-	{
-		gGL.getTexUnit(sDiffTex)->bind(mTexturep);
-					
-		for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
-			 iter != mDrawFace.end(); iter++)
+		LLFace *face = *iter;
+		LLVertexBuffer* buff = face->getVertexBuffer();
+		if(buff)
 		{
-			LLFace *face = *iter;
-			LLVertexBuffer* buff = face->getVertexBuffer();
-			if(buff)
-			{
-				buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
-				buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); 
-				gPipeline.addTrianglesDrawn(buff->getNumIndices());
-			}
+			buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+			buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); 
+			gPipeline.addTrianglesDrawn(buff->getNumIndices());
 		}
 	}
 }
 	gDeferredTreeShadowProgram.unbind();
 }
 
-
-void LLDrawPoolTree::renderTree(BOOL selecting)
-{
-	LLGLState normalize(GL_NORMALIZE, TRUE);
-	
-	// Bind the texture for this tree.
-	gGL.getTexUnit(sDiffTex)->bind(mTexturep.get(), TRUE);
-		
-	U32 indices_drawn = 0;
-
-	gGL.matrixMode(LLRender::MM_MODELVIEW);
-	
-	for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
-		 iter != mDrawFace.end(); iter++)
-	{
-		LLFace *face = *iter;
-		LLDrawable *drawablep = face->getDrawable();
-
-		if (drawablep->isDead() || !face->getVertexBuffer())
-		{
-			continue;
-		}
-
-		face->getVertexBuffer()->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
-		U16* indicesp = (U16*) face->getVertexBuffer()->getIndicesPointer();
-
-		// Render each of the trees
-		LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get();
-
-		LLColor4U color(255,255,255,255);
-
-		if (!selecting || treep->mGLName != 0)
-		{
-			if (selecting)
-			{
-				S32 name = treep->mGLName;
-				
-				color = LLColor4U((U8)(name >> 16), (U8)(name >> 8), (U8)name, 255);
-			}
-			
-			gGLLastMatrix = NULL;
-			gGL.loadMatrix(gGLModelView);
-			//gGL.pushMatrix();
-			F32 mat[16];
-			for (U32 i = 0; i < 16; i++)
-				mat[i] = (F32) gGLModelView[i];
-
-			LLMatrix4 matrix(mat);
-			
-			// Translate to tree base  HACK - adjustment in Z plants tree underground
-			const LLVector3 &pos_agent = treep->getPositionAgent();
-			//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
-			LLMatrix4 trans_mat;
-			trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
-			trans_mat *= matrix;
-			
-			// Rotate to tree position and bend for current trunk/wind
-			// Note that trunk stiffness controls the amount of bend at the trunk as 
-			// opposed to the crown of the tree
-			// 
-			const F32 TRUNK_STIFF = 22.f;
-			
-			LLQuaternion rot = 
-				LLQuaternion(treep->mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(treep->mTrunkBend.mV[VX], treep->mTrunkBend.mV[VY], 0)) *
-				LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) *
-				treep->getRotation();
-
-			LLMatrix4 rot_mat(rot);
-			rot_mat *= trans_mat;
-
-			F32 radius = treep->getScale().magVec()*0.05f;
-			LLMatrix4 scale_mat;
-			scale_mat.mMatrix[0][0] = 
-				scale_mat.mMatrix[1][1] =
-				scale_mat.mMatrix[2][2] = radius;
-
-			scale_mat *= rot_mat;
-
-			const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f;
-			const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f;
-
-			F32 droop = treep->mDroop + 25.f*(1.f - treep->mTrunkBend.magVec());
-			
-			S32 stop_depth = 0;
-			F32 app_angle = treep->getAppAngle()*LLVOTree::sTreeFactor;
-			F32 alpha = 1.0;
-			S32 trunk_LOD = LLVOTree::sMAX_NUM_TREE_LOD_LEVELS;
-
-			for (S32 j = 0; j < 4; j++)
-			{
-
-				if (app_angle > LLVOTree::sLODAngles[j])
-				{
-					trunk_LOD = j;
-					break;
-				}
-			} 
-			if(trunk_LOD >= LLVOTree::sMAX_NUM_TREE_LOD_LEVELS)
-			{
-				continue ; //do not render.
-			}
-
-			if (app_angle < (THRESH_ANGLE_FOR_BILLBOARD - BLEND_RANGE_FOR_BILLBOARD))
-			{
-				//
-				//  Draw only the billboard 
-				//
-				//  Only the billboard, can use closer to normal alpha func.
-				stop_depth = -1;
-				LLFacePool::LLOverrideFaceColor clr(this, color); 
-				indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha);
-			}
-			else // if (app_angle > (THRESH_ANGLE_FOR_BILLBOARD + BLEND_RANGE_FOR_BILLBOARD))
-			{
-				//
-				//  Draw only the full geometry tree
-				//
-				//stop_depth = (app_angle < THRESH_ANGLE_FOR_RECURSION_REDUCTION);
-				LLFacePool::LLOverrideFaceColor clr(this, color); 
-				indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha);
-			}
-			
-			//gGL.popMatrix();
-		}
-	}
-}
-
 BOOL LLDrawPoolTree::verify() const
 {
 /*	BOOL ok = TRUE;

indra/newview/lldrawpooltree.h

 	/*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display
 
 	static S32 sDiffTex;
-
-private:
-	void renderTree(BOOL selecting = FALSE);
 };
 
 #endif // LL_LLDRAWPOOLTREE_H

indra/newview/llfloaterwebcontent.cpp

 LLFloaterWebContent::LLFloaterWebContent( const Params& params )
 :	LLFloater( params ),
 	LLInstanceTracker<LLFloaterWebContent, std::string>(params.id()),
+	mWebBrowser(NULL),
+	mAddressCombo(NULL),
+	mSecureLockIcon(NULL),
+	mStatusBarText(NULL),
+	mStatusBarProgress(NULL),
+	mBtnBack(NULL),
+	mBtnForward(NULL),
+	mBtnReload(NULL),
+	mBtnStop(NULL),
 	mUUID(params.id()),
 	mShowPageTitle(params.show_page_title)
 {
 	mStatusBarText     = getChild< LLTextBox >( "statusbartext" );
 	mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
 
+	mBtnBack           = getChildView( "back" );
+	mBtnForward        = getChildView( "forward" );
+	mBtnReload         = getChildView( "reload" );
+	mBtnStop           = getChildView( "stop" );
+
 	// observe browser events
 	mWebBrowser->addObserver( this );
 
 	// these buttons are always enabled
-	getChildView("reload")->setEnabled( true );
+	mBtnReload->setEnabled( true );
 	getChildView("popexternal")->setEnabled( true );
 
 	// cache image for secure browsing
 void LLFloaterWebContent::draw()
 {
 	// this is asynchronous so we need to keep checking
-	getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() );
-	getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() );
+	mBtnBack->setEnabled( mWebBrowser->canNavigateBack() );
+	mBtnForward->setEnabled( mWebBrowser->canNavigateForward() );
 
 	LLFloater::draw();
 }
 	else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
 	{
 		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+		mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+		mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
 
 		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( false );
-		getChildView("stop")->setVisible( true );
+		mBtnReload->setVisible( false );
+		mBtnStop->setVisible( true );
 
 		// turn "on" progress bar now we're about to start loading
 		mStatusBarProgress->setVisible( true );
 	else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
 	{
 		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+		mBtnBack->setEnabled( self->getHistoryBackAvailable() );
+		mBtnForward->setEnabled( self->getHistoryForwardAvailable() );
 
 		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( true );
-		getChildView("stop")->setVisible( false );
+		mBtnReload->setVisible( true );
+		mBtnStop->setVisible( false );
 
 		// turn "off" progress bar now we're loaded
 		mStatusBarProgress->setVisible( false );
 	// still should happen when we catch the navigate complete event
 	// but sometimes (don't know why) that event isn't sent from Qt
 	// and we ghetto a point where the stop button stays active.
-	getChildView("reload")->setVisible( true );
-	getChildView("stop")->setVisible( false );
+	mBtnReload->setVisible( true );
+	mBtnStop->setVisible( false );
 }
 
 void LLFloaterWebContent::onEnterAddress()

indra/newview/llfloaterwebcontent.h

 	LLIconCtrl*		mSecureLockIcon;
 	LLTextBox*		mStatusBarText;
 	LLProgressBar*	mStatusBarProgress;
+
+	LLView*			mBtnBack;
+	LLView*			mBtnForward;
+	LLView*			mBtnReload;
+	LLView*			mBtnStop;
+
 	std::string		mCurrentURL;
 	std::string		mUUID;
 	bool			mShowPageTitle;

indra/newview/llnearbychatbar.cpp

 };
 
 LLNearbyChatBar::LLNearbyChatBar(const LLSD& key)
-	: LLFloater(key),
-	mChatBox(NULL)
-{	mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
+:	LLFloater(key),
+	mChatBox(NULL),
+	mNearbyChat(NULL),
+	mOutputMonitor(NULL),
+	mSpeakerMgr(NULL),
+	mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
+{
+	mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
 }
 
 //virtual
 	mChatBox->setEnableLineHistory(TRUE);
 	mChatBox->setFont(LLViewerChat::getChatFont());
 
+	mNearbyChat = getChildView("nearby_chat");
 
 	LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat");
 	show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this));
 	// Register for font change notifications
 	LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1));
 
-	mExpandedHeight = COLLAPSED_HEIGHT + EXPANDED_HEIGHT;
-
 	enableResizeCtrls(true, true, false);
 
 	return TRUE;
 {
 	bool rect_controlled = LLFloater::applyRectControl();
 
-	LLView* nearby_chat = getChildView("nearby_chat");	
-	if (!nearby_chat->getVisible())
+	if (!mNearbyChat->getVisible())
 	{
 		reshape(getRect().getWidth(), getMinHeight());
 		enableResizeCtrls(true, true, false);

indra/newview/llnearbychatbar.h

 	// Which non-zero channel did we last chat on?
 	static S32 sLastSpecialChatChannel;
 
-	LLLineEditor*		mChatBox;
-	LLOutputMonitorCtrl* mOutputMonitor;
-	LLLocalSpeakerMgr*  mSpeakerMgr;
+	LLLineEditor*			mChatBox;
+	LLView*					mNearbyChat;
+	LLOutputMonitorCtrl*	mOutputMonitor;
+	LLLocalSpeakerMgr*		mSpeakerMgr;
 
 	S32 mExpandedHeight;
 };

indra/newview/llnearbychathandler.cpp

 	if(mStopProcessing || isHovering())
 		return;
 
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
 	if (!getParent())
 	{
 		// connect to floater snap region just to get resize events, we don't care about being a proper widget 
-		floater_snap_region->addChild(this);
+		mFloaterSnapRegion->addChild(this);
 		setFollows(FOLLOWS_ALL);
 	}
 
 	updateRect();
 
 	LLRect channel_rect;
-	floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView);
+	mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView);
 	channel_rect.mLeft += 10;
 	channel_rect.mRight = channel_rect.mLeft + 300;
 

indra/newview/llscreenchannel.cpp

 LLRect LLScreenChannelBase::getChannelRect()
 {
 	LLFastTimer _(FTM_GET_CHANNEL_RECT);
+
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
+	if (mChicletRegion == NULL)
+	{
+		mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+	}
+	
 	LLRect channel_rect;
 	LLRect chiclet_rect;
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-	floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect);
 
-	LLView* chiclet_region = gViewerWindow->getRootView()->getChildView("chiclet_container");
-	chiclet_region->localRectToScreen(chiclet_region->getLocalRect(), &chiclet_rect);
+	mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect);
+	mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect);
 
 	channel_rect.mTop = chiclet_rect.mBottom;
 	return channel_rect;
 	mShowToasts(true),
 	mID(p.id),
 	mDisplayToastsAlways(p.display_toasts_always),
-	mChannelAlignment(p.channel_align)
-{	
+	mChannelAlignment(p.channel_align),
+	mFloaterSnapRegion(NULL),
+	mChicletRegion(NULL)
+{
 	mID = p.id;
 
 	setMouseOpaque( false );
 	setVisible(FALSE);
 }
 
+BOOL LLScreenChannelBase::postBuild()
+{
+	if (mFloaterSnapRegion == NULL)
+	{
+		mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	}
+	
+	if (mChicletRegion == NULL)
+	{
+		mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container");
+	}
+	
+	return TRUE;
+}
+
 void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	redrawToasts();
 //--------------------------------------------------------------------------
 void LLScreenChannel::redrawToasts()
 {
-	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
-
 	if (!getParent())
 	{
 		// connect to floater snap region just to get resize events, we don't care about being a proper widget 
-		floater_snap_region->addChild(this);
+		mFloaterSnapRegion->addChild(this);
 		setFollows(FOLLOWS_ALL);
 	}
 

indra/newview/llscreenchannel.h

 	};
 
 	LLScreenChannelBase(const Params&);
+	
+	BOOL postBuild();
 
 	void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
 
 	// Channel's flags
 	bool		mControlHovering;
-	LLToast*		mHoveredToast;
+	LLToast*	mHoveredToast;
 	bool		mCanStoreToasts;
 	bool		mDisplayToastsAlways;
 	// controls whether a channel shows toasts or not
 
 	// channel's ID
 	LLUUID	mID;
+	
+	LLView*	mFloaterSnapRegion;
+	LLView* mChicletRegion;
 };
 
 

indra/newview/llsidepaneltaskinfo.cpp

 	childSetCommitCallback("checkbox next owner can transfer",	&LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this);
 	childSetCommitCallback("clickaction",						&LLSidepanelTaskInfo::onCommitClickAction,this);
 	childSetCommitCallback("search_check",						&LLSidepanelTaskInfo::onCommitIncludeInSearch,this);
+	
+	mDAPermModify = getChild<LLUICtrl>("perm_modify");
+	mDACreator = getChildView("Creator:");
+	mDACreatorName = getChild<LLUICtrl>("Creator Name");
+	mDAOwner = getChildView("Owner:");
+	mDAOwnerName = getChild<LLUICtrl>("Owner Name");
+	mDAGroup = getChildView("Group:");
+	mDAGroupName = getChild<LLUICtrl>("Group Name");
+	mDAButtonSetGroup = getChildView("button set group");
+	mDAObjectName = getChild<LLUICtrl>("Object Name");
+	mDAName = getChildView("Name:");
+	mDADescription = getChildView("Description:");
+	mDAObjectDescription = getChild<LLUICtrl>("Object Description");
+	mDAPermissions = getChildView("Permissions:");
+	mDACheckboxShareWithGroup = getChild<LLUICtrl>("checkbox share with group");
+	mDAButtonDeed = getChildView("button deed");
+	mDACheckboxAllowEveryoneMove = getChild<LLUICtrl>("checkbox allow everyone move");
+	mDACheckboxAllowEveryoneCopy = getChild<LLUICtrl>("checkbox allow everyone copy");
+	mDANextOwnerCan = getChildView("Next owner can:");
+	mDACheckboxNextOwnerCanModify = getChild<LLUICtrl>("checkbox next owner can modify");
+	mDACheckboxNextOwnerCanCopy = getChild<LLUICtrl>("checkbox next owner can copy");
+	mDACheckboxNextOwnerCanTransfer = getChild<LLUICtrl>("checkbox next owner can transfer");
+	mDACheckboxForSale = getChild<LLUICtrl>("checkbox for sale");
+	mDASearchCheck = getChild<LLUICtrl>("search_check");
+	mDAComboSaleType = getChild<LLComboBox>("sale type");
+	mDACost = getChild<LLUICtrl>("Cost");
+	mDAEditCost = getChild<LLUICtrl>("Edit Cost");
+	mDALabelClickAction = getChildView("label click action");
+	mDAComboClickAction = getChild<LLComboBox>("clickaction");
+	mDAB = getChildView("B:");
+	mDAO = getChildView("O:");
+	mDAG = getChildView("G:");
+	mDAE = getChildView("E:");
+	mDAN = getChildView("N:");
+	mDAF = getChildView("F:");
+	
 	return TRUE;
 }
 
 
 void LLSidepanelTaskInfo::disableAll()
 {
-	getChildView("perm_modify")->setEnabled(FALSE);
-	getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null);
+	mDAPermModify->setEnabled(FALSE);
+	mDAPermModify->setValue(LLStringUtil::null);
 
-	getChildView("Creator:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null);
-	getChildView("Creator Name")->setEnabled(FALSE);
+	mDACreator->setEnabled(FALSE);
+	mDACreatorName->setValue(LLStringUtil::null);
+	mDACreatorName->setEnabled(FALSE);
 
-	getChildView("Owner:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Owner Name")->setValue(LLStringUtil::null);
-	getChildView("Owner Name")->setEnabled(FALSE);
+	mDAOwner->setEnabled(FALSE);
+	mDAOwnerName->setValue(LLStringUtil::null);
+	mDAOwnerName->setEnabled(FALSE);
 
-	getChildView("Group:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
-	getChildView("Group Name")->setEnabled(FALSE);
-	getChildView("button set group")->setEnabled(FALSE);
+	mDAGroup->setEnabled(FALSE);
+	mDAGroupName->setValue(LLStringUtil::null);
+	mDAGroupName->setEnabled(FALSE);
+	mDAButtonSetGroup->setEnabled(FALSE);
 
-	getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
-	getChildView("Object Name")->setEnabled(FALSE);
-	getChildView("Name:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
-	getChildView("Group Name")->setEnabled(FALSE);
-	getChildView("Description:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null);
-	getChildView("Object Description")->setEnabled(FALSE);
+	mDAObjectName->setValue(LLStringUtil::null);
+	mDAObjectName->setEnabled(FALSE);
+	mDAName->setEnabled(FALSE);
+	mDAGroupName->setValue(LLStringUtil::null);
+	mDAGroupName->setEnabled(FALSE);
+	mDADescription->setEnabled(FALSE);
+	mDAObjectDescription->setValue(LLStringUtil::null);
+	mDAObjectDescription->setEnabled(FALSE);
 
-	getChildView("Permissions:")->setEnabled(FALSE);
+	mDAPermissions->setEnabled(FALSE);
 		
-	getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE);
-	getChildView("checkbox share with group")->setEnabled(FALSE);
-	getChildView("button deed")->setEnabled(FALSE);
+	mDACheckboxShareWithGroup->setValue(FALSE);
+	mDACheckboxShareWithGroup->setEnabled(FALSE);
+	mDAButtonDeed->setEnabled(FALSE);
 
-	getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE);
-	getChildView("checkbox allow everyone move")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE);
-	getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
+	mDACheckboxAllowEveryoneMove->setValue(FALSE);
+	mDACheckboxAllowEveryoneMove->setEnabled(FALSE);
+	mDACheckboxAllowEveryoneCopy->setValue(FALSE);
+	mDACheckboxAllowEveryoneCopy->setEnabled(FALSE);
 
 	//Next owner can:
-	getChildView("Next owner can:")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE);
-	getChildView("checkbox next owner can modify")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE);
-	getChildView("checkbox next owner can copy")->setEnabled(FALSE);
-	getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE);
-	getChildView("checkbox next owner can transfer")->setEnabled(FALSE);
+	mDANextOwnerCan->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanModify->setValue(FALSE);
+	mDACheckboxNextOwnerCanModify->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanCopy->setValue(FALSE);
+	mDACheckboxNextOwnerCanCopy->setEnabled(FALSE);
+	mDACheckboxNextOwnerCanTransfer->setValue(FALSE);
+	mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE);
 
 	//checkbox for sale
-	getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE);
-	getChildView("checkbox for sale")->setEnabled(FALSE);
+	mDACheckboxForSale->setValue(FALSE);
+	mDACheckboxForSale->setEnabled(FALSE);
 
 	//checkbox include in search
-	getChild<LLUICtrl>("search_check")->setValue(FALSE);
-	getChildView("search_check")->setEnabled(FALSE);
+	mDASearchCheck->setValue(FALSE);
+	mDASearchCheck->setEnabled(FALSE);
 		
-	LLComboBox*	combo_sale_type = getChild<LLComboBox>("sale type");
-	combo_sale_type->setValue(LLSaleInfo::FS_COPY);
-	combo_sale_type->setEnabled(FALSE);
+	mDAComboSaleType->setValue(LLSaleInfo::FS_COPY);
+	mDAComboSaleType->setEnabled(FALSE);
 		
-	getChildView("Cost")->setEnabled(FALSE);
-	getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default"));
-	getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null);
-	getChildView("Edit Cost")->setEnabled(FALSE);
+	mDACost->setEnabled(FALSE);
+	mDACost->setValue(getString("Cost Default"));
+	mDAEditCost->setValue(LLStringUtil::null);
+	mDAEditCost->setEnabled(FALSE);
 		
-	getChildView("label click action")->setEnabled(FALSE);
-	LLComboBox*	combo_click_action = getChild<LLComboBox>("clickaction");
-	if (combo_click_action)
+	mDALabelClickAction->setEnabled(FALSE);
+	if (mDAComboClickAction)
 	{
-		combo_click_action->setEnabled(FALSE);
-		combo_click_action->clear();
+		mDAComboClickAction->setEnabled(FALSE);
+		mDAComboClickAction->clear();
 	}
-	getChildView("B:")->setVisible(								FALSE);
-	getChildView("O:")->setVisible(								FALSE);
-	getChildView("G:")->setVisible(								FALSE);
-	getChildView("E:")->setVisible(								FALSE);
-	getChildView("N:")->setVisible(								FALSE);
-	getChildView("F:")->setVisible(								FALSE);
+
+	mDAB->setVisible(FALSE);
+	mDAO->setVisible(FALSE);
+	mDAG->setVisible(FALSE);
+	mDAE->setVisible(FALSE);
+	mDAN->setVisible(FALSE);
+	mDAF->setVisible(FALSE);
 	
 	mOpenBtn->setEnabled(FALSE);
 	mPayBtn->setEnabled(FALSE);

indra/newview/llsidepaneltaskinfo.h

 // Panel for permissions of an object.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+class LLCheckBoxCtrl;
+class LLComboBox;
 class LLNameBox;
-class LLCheckBoxCtrl;
 class LLViewerObject;
 
 class LLSidepanelTaskInfo : public LLSidepanelInventorySubpanel
 	LLPointer<LLViewerObject>	mObject;
 	LLObjectSelectionHandle		mObjectSelection;
 	static LLSidepanelTaskInfo* sActivePanel;
+	
+private:
+	// Pointers cached here to speed up the "disableAll" function which gets called on idle
+	LLUICtrl*	mDAPermModify;
+	LLView*		mDACreator;
+	LLUICtrl*	mDACreatorName;
+	LLView*		mDAOwner;
+	LLUICtrl*	mDAOwnerName;
+	LLView*		mDAGroup;
+	LLUICtrl*	mDAGroupName;
+	LLView*		mDAButtonSetGroup;
+	LLUICtrl*	mDAObjectName;
+	LLView*		mDAName;
+	LLView*		mDADescription;
+	LLUICtrl*	mDAObjectDescription;
+	LLView*		mDAPermissions;
+	LLUICtrl*	mDACheckboxShareWithGroup;
+	LLView*		mDAButtonDeed;
+	LLUICtrl*	mDACheckboxAllowEveryoneMove;
+	LLUICtrl*	mDACheckboxAllowEveryoneCopy;
+	LLView*		mDANextOwnerCan;
+	LLUICtrl*	mDACheckboxNextOwnerCanModify;
+	LLUICtrl*	mDACheckboxNextOwnerCanCopy;
+	LLUICtrl*	mDACheckboxNextOwnerCanTransfer;
+	LLUICtrl*	mDACheckboxForSale;
+	LLUICtrl*	mDASearchCheck;
+	LLComboBox*	mDAComboSaleType;
+	LLUICtrl*	mDACost;
+	LLUICtrl*	mDAEditCost;
+	LLView*		mDALabelClickAction;
+	LLComboBox*	mDAComboClickAction;
+	LLView*		mDAB;
+	LLView*		mDAO;
+	LLView*		mDAG;
+	LLView*		mDAE;
+	LLView*		mDAN;
+	LLView*		mDAF;
 };
 
 

indra/newview/llstatusbar.cpp

 	mTextTime(NULL),
 	mSGBandwidth(NULL),
 	mSGPacketLoss(NULL),
+	mBtnStats(NULL),
 	mBtnVolume(NULL),
 	mBoxBalance(NULL),
 	mBalance(0),
 
 	mBoxBalance = getChild<LLTextBox>("balance");
 	mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
+	
+	mBtnStats = getChildView("stat_btn");
 
 	mBtnVolume = getChild<LLButton>( "volume_btn" );
 	mBtnVolume->setClickedCallback( onClickVolume, this );
 
 	mSGBandwidth->setVisible(net_stats_visible);
 	mSGPacketLoss->setVisible(net_stats_visible);
-	getChildView("stat_btn")->setEnabled(net_stats_visible);
+	mBtnStats->setEnabled(net_stats_visible);
 
 	// update the master volume button state
 	bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();

indra/newview/llstatusbar.h

 	LLStatGraph *mSGBandwidth;
 	LLStatGraph *mSGPacketLoss;
 
+	LLView		*mBtnStats;
 	LLButton	*mBtnVolume;
 	LLTextBox	*mBoxBalance;
 	LLButton	*mMediaToggle;
-	LLView*		mScriptOut;
+	LLView		*mScriptOut;
 	LLFrameTimer	mClockUpdateTimer;
 
 	S32				mBalance;

indra/newview/llviewercontrol.cpp

 	gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
 	gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
-	gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
 	gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
 	gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));

indra/newview/llviewerdisplay.cpp

 		glClear(GL_COLOR_BUFFER_BIT);
 		gViewerWindow->getWindow()->swapBuffers();
 		LLPipeline::refreshCachedSettings();
-		LLPipeline::refreshRenderDeferred();
 		gPipeline.resizeScreenTexture();
 		gResizeScreenTexture = FALSE;
 		gWindowResized = FALSE;
 		//Increment drawable frame counter
 		LLDrawable::incrementVisible();
 
-		LLPipeline::refreshCachedSettings();
-		LLPipeline::refreshRenderDeferred();
-
 		LLSpatialGroup::sNoDelete = TRUE;
 		LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
 

indra/newview/llviewershadermgr.cpp

 	if (success)
 	{
 		gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader";
+		gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.clear();
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));

indra/newview/llvoavatar.cpp

 	mFullyLoadedInitialized(FALSE),
 	mSupportsAlphaLayers(FALSE),
 	mLoadedCallbacksPaused(FALSE),
-	mHasPelvisOffset( FALSE )
+	mHasPelvisOffset( FALSE ),
+	mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar"))
 {
 	LLMemType mt(LLMemType::MTYPE_AVATAR);
 	//VTResume();  // VTune
 
 BOOL LLVOAvatar::isFullyLoaded() const
 {
-	if (gSavedSettings.getBOOL("RenderUnloadedAvatar"))
-		return TRUE;
-	else
-		return mFullyLoaded;
+	return (mRenderUnloadedAvatar || mFullyLoaded);
 }
 
 bool LLVOAvatar::isTooComplex() const

indra/newview/llvoavatar.h

 #include "lldrawpoolalpha.h"
 #include "llviewerobject.h"
 #include "llcharacter.h"
+#include "llcontrol.h"
 #include "llviewerjointmesh.h"
 #include "llviewerjointattachment.h"
 #include "llrendertarget.h"
 	F32			mImpostorDistance;
 	F32			mImpostorPixelArea;
 	LLVector3	mLastAnimExtents[2];  
+	
+	LLCachedControl<bool> mRenderUnloadedAvatar;
 
 	//--------------------------------------------------------------------
 	// Wind rippling in clothes

indra/newview/llvotree.cpp

 
 BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 {
-	const U16 FRAMES_PER_WIND_UPDATE = 20;				//  How many frames between wind update per tree
-	const F32 TREE_WIND_SENSITIVITY = 0.005f;
-	const F32 TREE_TRUNK_STIFFNESS = 0.1f;
-
  	if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
 	{
 		return TRUE;
 	}
 	
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
-	{
-		F32 mass_inv; 
-
-		//  For all tree objects, update the trunk bending with the current wind 
-		//  Walk sprite list in order away from viewer 
-		if (!(mFrameCount % FRAMES_PER_WIND_UPDATE)) 
-		{
-			//  If needed, Get latest wind for this tree
-			mWind = mRegionp->mWind.getVelocity(getPositionRegion());
-		}
-		mFrameCount++;
-
-		mass_inv = 1.f/(5.f + mDepth*mBranches*0.2f);
-		mTrunkVel += (mWind * mass_inv * TREE_WIND_SENSITIVITY);		//  Pull in direction of wind
-		mTrunkVel -= (mTrunkBend * mass_inv * TREE_TRUNK_STIFFNESS);		//  Restoring force in direction of trunk 	
-		mTrunkBend += mTrunkVel;
-		mTrunkVel *= 0.99f;									//  Add damping
-
-		if (mTrunkBend.length() > 1.f)
-		{
-			mTrunkBend.normalize();
-		}
-
-		if (mTrunkVel.length() > 1.f)
-		{
-			mTrunkVel.normalize();
-		}
-	}
-
 	S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ;
 	F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
 
 		}
 	} 
 
-	if (!gSavedSettings.getBOOL("RenderAnimateTrees"))
+	if (mReferenceBuffer.isNull())
 	{
-		if (mReferenceBuffer.isNull())
+		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
+	}
+	else if (trunk_LOD != mTrunkLOD)
+	{
+		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
+	}
+	else
+	{
+		// we're not animating but we may *still* need to
+		// regenerate the mesh if we moved, since position
+		// and rotation are baked into the mesh.
+		// *TODO: I don't know what's so special about trees
+		// that they don't get REBUILD_POSITION automatically
+		// at a higher level.
+		const LLVector3 &this_position = getPositionAgent();
+		if (this_position != mLastPosition)
 		{
-			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
-		}
-		else if (trunk_LOD != mTrunkLOD)
-		{
-			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
+			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
+			mLastPosition = this_position;
 		}
 		else
 		{
-			// we're not animating but we may *still* need to
-			// regenerate the mesh if we moved, since position
-			// and rotation are baked into the mesh.
-			// *TODO: I don't know what's so special about trees
-			// that they don't get REBUILD_POSITION automatically
-			// at a higher level.
-			const LLVector3 &this_position = getPositionAgent();
-			if (this_position != mLastPosition)
+			const LLQuaternion &this_rotation = getRotation();
+			
+			if (this_rotation != mLastRotation)
 			{
 				gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
-				mLastPosition = this_position;
-			}
-			else
-			{
-				const LLQuaternion &this_rotation = getRotation();
-				
-				if (this_rotation != mLastRotation)
-				{
-					gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
-					mLastRotation = this_rotation;
-				}
+				mLastRotation = this_rotation;
 			}
 		}
 	}
 			max_vertices += sLODVertexCount[lod];
 		}
 
-		mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, gSavedSettings.getBOOL("RenderAnimateTrees") ? GL_STATIC_DRAW_ARB : 0);
+		mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0);
 		mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE);
 
 		LLStrider<LLVector3> vertices;
 		llassert(index_count == max_indices);
 	}
 
-	if (gSavedSettings.getBOOL("RenderAnimateTrees"))
-	{
-		mDrawable->getFace(0)->setVertexBuffer(mReferenceBuffer);
-	}
-	else
-	{
-		//generate tree mesh
-		updateMesh();
-	}
+	//generate tree mesh
+	updateMesh();
 	
 	return TRUE;
 }

indra/newview/llvotree.h

 	friend class LLDrawPoolTree;
 protected:
 	LLVector3		mTrunkBend;		// Accumulated wind (used for blowing trees)
-	LLVector3		mTrunkVel;		// 
 	LLVector3		mWind;
 
 	LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh

indra/newview/llvovolume.cpp

 
 void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort, BOOL batch_textures)
 {
+	U32 buffer_usage = group->mBufferUsage;
+	
+#if LL_DARWIN
+	// HACK from Leslie:
+	// Disable VBO usage for alpha on Mac OS X because it kills the framerate
+	// due to implicit calls to glTexSubImage that are beyond our control.
+	// (this works because the only calls here that sort by distance are alpha)
+	if (distance_sort)
+	{
+		buffer_usage = 0x0;
+	}
+#endif
+	
 	//calculate maximum number of vertices to store in a single buffer
 	U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask);
 	max_vertices = llmin(max_vertices, (U32) 65535);
 						
 		if (!buffer)
 		{ //create new buffer if needed
-			buffer = createVertexBuffer(mask, 
-											group->mBufferUsage);
+			buffer = createVertexBuffer(mask, buffer_usage);
 			buffer->allocateBuffer(geom_count, index_count, TRUE);
 		}
 		else 
 		{ //resize pre-existing buffer
-			if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != group->mBufferUsage ||
+			if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != buffer_usage ||
 				buffer->getTypeMask() != mask)
 			{
-				buffer = createVertexBuffer(mask, 
-											group->mBufferUsage);
+				buffer = createVertexBuffer(mask, buffer_usage);
 				buffer->allocateBuffer(geom_count, index_count, TRUE);
 			}
 			else
 				{
 					registerFace(group, facep, LLRenderPass::PASS_ALPHA);
 				}
-
-				if (LLPipeline::sRenderDeferred)
-				{
-					registerFace(group, facep, LLRenderPass::PASS_ALPHA_SHADOW);
-				}
 			}
 			else if (gPipeline.canUseVertexShaders()
 				&& group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD 

indra/newview/pipeline.cpp

 	mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
 	mDeferredVB->allocateBuffer(8, 0, true);
 	setLightingDetail(-1);
+	
+	//
+	// Update all settings to trigger a cached settings refresh
+	//
+
+	gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderUseFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAvatarMaxVisible")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDelayVBUpdate")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	
+	gSavedSettings.getControl("UseOcclusion")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	
+	gSavedSettings.getControl("VertexShaderEnable")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAvatarVP")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredSunWash")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderResolutionDivisor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderUIBuffer")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredSSAO")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowResolutionScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderLocalLights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDelayCreation")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderAnimateRes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("FreezeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("DebugBeaconLineWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightBrightness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightThickness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotLightsInNondeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewAmbientColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDiffuse2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewSpecular2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("PreviewDirection2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowMinLuminance")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowMaxExtractAlpha")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWarmthAmount")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowLumWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWarmthWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowResolutionPow")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowIterations")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderGlowStrength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDepthOfField")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFocusTransitionTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFNumber")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFocalLength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraFieldOfView")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowNoise")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBlurSize")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOMaxScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSSAOEffect")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOffsetError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBiasError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderSpotShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderEdgeDepthCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderEdgeNormCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowGaussian")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowBlurDistFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderDeferredAtmospheric")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderReflectionDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderHighlightFadeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowOrthoClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowNearDist")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowSplitExponent")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowErrorCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("RenderShadowFOVCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraMaxCoF")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
+	gSavedSettings.getControl("CameraDoFResScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
 }
 
 LLPipeline::~LLPipeline()
 bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 {
 	refreshCachedSettings();
-	refreshRenderDeferred();
 
 	// remember these dimensions
 	mScreenWidth = resX;
 }
 
 //static
-void LLPipeline::refreshRenderDeferred()
-{
-	updateRenderDeferred();
-}
-
-//static
 void LLPipeline::refreshCachedSettings()
 {
 	LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
 	CameraOffset = gSavedSettings.getBOOL("CameraOffset");
 	CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF");
 	CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale");
+	
+	updateRenderDeferred();
 }
 
 void LLPipeline::releaseGLBuffers()
 	LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping);
 }
 
-void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture)
+void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
 {
 	LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS);
 	assertInitialized();
 	gGL.loadMatrix(gGLModelView);
 	gGLLastMatrix = NULL;
-	mSimplePool->pushBatches(type, mask);
+	mSimplePool->pushBatches(type, mask, texture, batch_texture);
 	gGL.loadMatrix(gGLModelView);
 	gGLLastMatrix = NULL;		
 }
 	}
 	LLPipeline::sShadowRender = TRUE;
 	
-	U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP, LLRenderPass::PASS_FULLBRIGHT_SHINY };
+	U32 types[] = { 
+		LLRenderPass::PASS_SIMPLE, 
+		LLRenderPass::PASS_FULLBRIGHT, 
+		LLRenderPass::PASS_SHINY, 
+		LLRenderPass::PASS_BUMP, 
+		LLRenderPass::PASS_FULLBRIGHT_SHINY 
+	};
+
 	LLGLEnable cull(GL_CULL_FACE);
 
 	if (use_shader)
 		LLFastTimer ftm(FTM_SHADOW_ALPHA);
 		gDeferredShadowAlphaMaskProgram.bind();
 		gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f);
-		renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
+		
+		U32 mask =	LLVertexBuffer::MAP_VERTEX | 
+					LLVertexBuffer::MAP_TEXCOORD0 | 
+					LLVertexBuffer::MAP_COLOR | 
+					LLVertexBuffer::MAP_TEXTURE_INDEX;
+
+		renderObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE);
+		renderObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE);
+		renderObjects(LLRenderPass::PASS_ALPHA, mask, TRUE, TRUE);
 		gDeferredTreeShadowProgram.bind();
 		gDeferredTreeShadowProgram.setMinimumAlpha(0.598f);
 		renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
 					LLPipeline::RENDER_TYPE_TERRAIN,
 					LLPipeline::RENDER_TYPE_WATER,
 					LLPipeline::RENDER_TYPE_VOIDWATER,
-					LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
+					LLPipeline::RENDER_TYPE_PASS_ALPHA,
+					LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK,
+					LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK,
 					LLPipeline::RENDER_TYPE_PASS_GRASS,
 					LLPipeline::RENDER_TYPE_PASS_SIMPLE,
 					LLPipeline::RENDER_TYPE_PASS_BUMP,

indra/newview/pipeline.h

 	void postSort(LLCamera& camera);
 	void forAllVisibleDrawables(void (*func)(LLDrawable*));
 
-	void renderObjects(U32 type, U32 mask, BOOL texture = TRUE);
+	void renderObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE);
 	void renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture);
 
 	void grabReferences(LLCullResult& result);
 	static BOOL getRenderHighlights(void* data);
 
 	static void updateRenderDeferred();
-	static void refreshRenderDeferred();
 	static void refreshCachedSettings();
 
 	static void throttleNewMemoryAllocation(BOOL disable);
 		RENDER_TYPE_PASS_ALPHA					= LLRenderPass::PASS_ALPHA,
 		RENDER_TYPE_PASS_ALPHA_MASK				= LLRenderPass::PASS_ALPHA_MASK,
 		RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK	= LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK,
-		RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW,
 		// Following are object types (only used in drawable mRenderType)
 		RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES,
 		RENDER_TYPE_VOLUME,