diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 97aeae548afc824655b12907b64fce3be4bf0427..812fa7024bf00f55b2bda646964d677e8194eb97 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1887,6 +1887,17 @@ void LLRender::flush()
 void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
 { 
 	//the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095]
+	if (mCount > 2048)
+	{ //break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below
+		switch (mMode)
+		{
+			case LLRender::POINTS: flush(); break;
+			case LLRender::TRIANGLES: if (mCount%3==0) flush(); break;
+			case LLRender::QUADS: if(mCount%4 == 0) flush(); break; 
+			case LLRender::LINES: if (mCount%2 == 0) flush(); break;
+		}
+	}
+			
 	if (mCount > 4094)
 	{
 	//	llwarns << "GL immediate mode overflow.  Some geometry not drawn." << llendl;
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 830a7778ac5e16f9e3406d26eaa8e5c2bd1b7cdb..5d0d1ef9a3fa9a1bb7fd4939db5509d6a3d04924 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -5713,6 +5713,14 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 		return;
 	}
 
+
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+	if (shader)
+	{ //switch to "solid color" program for SH-2690 -- works around driver bug causing bad triangles when rendering silhouettes
+		gSolidColorProgram.bind();
+	}
+
 	gGL.matrixMode(LLRender::MM_MODELVIEW);
 	gGL.pushMatrix();
 	gGL.pushUIMatrix();
@@ -5835,6 +5843,11 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 	}
 	gGL.popMatrix();
 	gGL.popUIMatrix();
+
+	if (shader)
+	{
+		shader->bind();
+	}
 }
 
 //
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 010869053827eb89e886efc7afdb09f9df0dde9d..c3a2e6a712b530476aa7832f9434a039d5978a70 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -1035,6 +1035,8 @@ void LLVOSurfacePatch::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newM
 {
 	LLVector3 posAgent = getPositionAgent();
 	LLVector3 scale = getScale();
+	//make z-axis scale at least 1 to avoid shadow artifacts on totally flat land
+	scale.mV[VZ] = llmax(scale.mV[VZ], 1.f);
 	newMin.load3( (posAgent-scale*0.5f).mV); // Changing to 2.f makes the culling a -little- better, but still wrong
 	newMax.load3( (posAgent+scale*0.5f).mV);
 	LLVector4a pos;