From 66a445298e2991cbfd29affa445c76b56b8631d5 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 30 Apr 2010 17:28:09 -0600
Subject: [PATCH] the second round debug code for EXT-6792: Crash on ATI 3200

---
 indra/newview/llappviewer.cpp |  1 -
 indra/newview/pipeline.cpp    | 21 +++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 5af6f1778e6..858c8899393 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3950,7 +3950,6 @@ void LLAppViewer::idleNetwork()
 {
 	LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK);
 	pingMainloopTimeout("idleNetwork");
-	LLError::LLCallStacks::clear() ;
 	
 	gObjectList.mNumNewObjects = 0;
 	S32 total_decoded = 0;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 731f5d40be8..2d2fc385738 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2200,7 +2200,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 	//LLVertexBuffer::unbind();
 
 	grabReferences(result);
-
+	llpushcallstacks ;
 	for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 	{
 		LLSpatialGroup* group = *iter;
@@ -2218,7 +2218,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 			}
 		}
 	}
-
+	llpushcallstacks ;
 	for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 	{
 		LLSpatialGroup* group = *iter;
@@ -2234,7 +2234,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 		}
 	}
 	
-
+	llpushcallstacks ;
 	if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
 	{
 		for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
@@ -2248,7 +2248,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 			}
 		}
 	}
-
+	llpushcallstacks ;
 	{
 		LLFastTimer ftm(FTM_STATESORT_DRAWABLE);
 		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList();
@@ -2268,6 +2268,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 	}
 
 	postSort(camera);
+	llpushcallstacks ;
 }
 
 void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
@@ -7100,8 +7101,7 @@ inline float sgn(float a)
 }
 
 void LLPipeline::generateWaterReflection(LLCamera& camera_in)
-{
-	llpushcallstacks ;
+{	
 	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
 	{
 		BOOL skip_avatar_update = FALSE;
@@ -7110,6 +7110,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			skip_avatar_update = TRUE;
 		}
 
+		llpushcallstacks ;
 		if (!skip_avatar_update)
 		{
 			gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
@@ -7197,7 +7198,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 			glCullFace(GL_FRONT);
 
-			
 			static LLCullResult ref_result;
 			U32 ref_mask = 0;
 			if (LLDrawPoolWater::sNeedsDistortionUpdate)
@@ -7209,6 +7209,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 										(1 << LLPipeline::RENDER_TYPE_WL_SKY));
 					static LLCullResult result;
 					updateCull(camera, result);
+					llpushcallstacks ;
 					stateSort(camera, result);
 					mRenderTypeMask = tmp & ((1 << LLPipeline::RENDER_TYPE_SKY) |
 										(1 << LLPipeline::RENDER_TYPE_CLOUDS) |
@@ -7243,13 +7244,13 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 					LLGLUserClipPlane clip_plane(plane, mat, projection);
 					LLGLDisable cull(GL_CULL_FACE);
 					updateCull(camera, ref_result, 1);
+					llpushcallstacks ;
 					stateSort(camera, ref_result);
 				}
 				
 				ref_mask = mRenderTypeMask;
 				mRenderTypeMask = mask;
 			}
-
 			if (LLDrawPoolWater::sNeedsDistortionUpdate)
 			{
 				mRenderTypeMask = ref_mask;
@@ -7267,7 +7268,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 		}
 
 		camera.setOrigin(camera_in.getOrigin());
-
 		//render distortion map
 		static BOOL last_update = TRUE;
 		if (last_update)
@@ -7301,6 +7301,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 				LLGLUserClipPlane clip_plane(LLPlane(-pnorm, -(pd+pad)), mat, projection);
 				static LLCullResult result;
 				updateCull(camera, result, water_clip);
+				llpushcallstacks ;
 				stateSort(camera, result);
 
 				gGL.setColorMask(true, true);
@@ -7324,7 +7325,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			glClear(GL_DEPTH_BUFFER_BIT);
 		}
 		glClearColor(0.f, 0.f, 0.f, 0.f);
-
 		gViewerWindow->setup3DViewport();
 		mRenderTypeMask = type_mask;
 		LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
@@ -7340,6 +7340,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 		{
 			gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 		}
+		llpushcallstacks ;
 	}
 }
 
-- 
GitLab