diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 645274a99010de4807994c09a3cff8af0236a22a..239fa95a6f84683cb63126754bc0cffac6c8f1d3 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1579,9 +1579,10 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
             // GPUs tend to be very uptight about memory alignment as the DMA used to convey
             // said data to the card works better when well-aligned so plain old default-aligned heap mem is a no-no
             //new U8[width * height];
-            size_t mem_size = (width * height);
-            size_t rem = (mem_size & 0x3F);
-            mem_size += rem > 0 ? (mem_size + (32 - rem)) : 0;
+            size_t bytes_per_pixel = 1; // unsigned byte alpha channel only...
+            size_t row_size        = (width + 3) & ~0x3; // OpenGL 4-byte row align (even for things < 4 bpp...)
+            size_t pixels          = (row_size * height);
+            size_t mem_size        = pixels * bytes_per_pixel;
 
             alpha_data = (U8*)ll_aligned_malloc_32(mem_size);
 
@@ -1590,7 +1591,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
             bool skip_readback = LLRender::sNsightDebugSupport; // nSight doesn't support use of glReadPixels
 
             // SL-10625 and neither does Intel in many cases
-            skip_readback = skip_readback || gGLManager.mIsIntel; 
+            skip_readback = skip_readback;// || gGLManager.mIsIntel; 
 
 			if (!skip_readback)
 			{
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 9c072bb0aafe7851958a8c9e22c98e6dc436e1ec..b110a6a810b873d45c1217b180a4b9033bcde735 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -406,9 +406,9 @@ void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL t
 	}
 }
 
-void LLRenderPass::renderTexture(U32 type, U32 mask)
+void LLRenderPass::renderTexture(U32 type, U32 mask, BOOL batch_textures)
 {
-	pushBatches(type, mask, TRUE);
+	pushBatches(type, mask, batch_textures);
 }
 
 void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
@@ -461,6 +461,11 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
 
 void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
 {
+    if (!params.mCount)
+    {
+        return;
+    }
+
 	applyModelMatrix(params);
 
 	bool tex_setup = false;
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index df86d78a89706624a63efc2251d0057f482feedb..4eb9a4151d59daeb6912d10a1005197119774cd3 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -174,7 +174,7 @@ class LLRenderPass : public LLDrawPool
 	virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE);
 	virtual void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
 	virtual void renderGroups(U32 type, U32 mask, BOOL texture = TRUE);
-	virtual void renderTexture(U32 type, U32 mask);
+	virtual void renderTexture(U32 type, U32 mask, BOOL batch_textures = TRUE);
 
 };
 
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index fa9a0712fa4185cdbb2f0164ae77cec76370e008..5e283f7cd0a7919edadd9d6ea17dad944a32384a 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -213,7 +213,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
 	sNumRenders = 0;
 	if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled)
 	{
-		return TRUE;
+		return FALSE;
 	}
 
 	bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI;
@@ -248,7 +248,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
 					result = TRUE;
 					sNumRenders++;
 				}
-				gGL.flush();
+				//gGL.flush();
 				LLVertexBuffer::unbind();
 				
 				dynamicTexture->postRender(result);
@@ -261,6 +261,8 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
 		gPipeline.mWaterDis.flush();
 	}
 
+    gGL.flush();
+
 	return ret;
 }
 
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 736626debdd3e7dc13e00553a4065c825642714c..7101f6fbb0940ced83b4f8c14783d40597b38113 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -130,9 +130,6 @@ void display_startup()
 
 	gPipeline.updateGL();
 
-	// Update images?
-	//gImageList.updateImages(0.01f);
-	
 	// Written as branch to appease GCC which doesn't like different
 	// pointer types across ternary ops
 	//
@@ -149,11 +146,6 @@ void display_startup()
 	LLGLState::checkStates();
 	LLGLState::checkTextureChannels();
 
-	if (frame_count++ > 1) // make sure we have rendered a frame first
-	{
-		LLViewerDynamicTexture::updateAllInstances();
-	}
-
 	LLGLState::checkStates();
 	LLGLState::checkTextureChannels();
 
@@ -595,18 +587,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 	// Actually push all of our triangles to the screen.
 	//
 
-	// do render-to-texture stuff here
-	if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES))
-	{
-		LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures");
-		LL_RECORD_BLOCK_TIME(FTM_UPDATE_DYNAMIC_TEXTURES);
-		if (LLViewerDynamicTexture::updateAllInstances())
-		{
-			gGL.setColorMask(true, true);
-			glClear(GL_DEPTH_BUFFER_BIT);
-		}
-	}
-
 	gViewerWindow->setup3DViewport();
 
 	gPipeline.resetFrameStats();	// Reset per-frame statistics.
@@ -1037,10 +1017,26 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		if (!for_snapshot)
 		{
 			render_ui();
+		}
+
+        // do render-to-texture stuff here
+	    if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES))
+	    {
+		    LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures");
+		    LL_RECORD_BLOCK_TIME(FTM_UPDATE_DYNAMIC_TEXTURES);
+		    if (LLViewerDynamicTexture::updateAllInstances())
+		    {
+			    gGL.setColorMask(true, true);
+			    glClear(GL_DEPTH_BUFFER_BIT);
+		    }
+	    }
+
+        LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
+		if (!for_snapshot)
+		{
 			swap();
 		}
 
-		
 		LLSpatialGroup::sNoDelete = FALSE;
 		gPipeline.clearReferences();