Commits

davep committed 8c23835 Merge

merge

  • Participants
  • Parent commits 3daa512, 063f88f

Comments (0)

Files changed (27)

File indra/llcommon/llmemory.h

 
 #include "llmemtype.h"
 
-#if 0  //DON'T use ll_aligned_foo now that we use tcmalloc everywhere (tcmalloc aligns automatically at appropriate intervals)
+#if LL_DEBUG
 inline void* ll_aligned_malloc( size_t size, int align )
 {
 	void* mem = malloc( size + (align - 1) + sizeof(void*) );
 	free(p); // posix_memalign() is compatible with heap deallocator
 #endif
 }
-#endif
+#else // LL_DEBUG
+// ll_aligned_foo are noops now that we use tcmalloc everywhere (tcmalloc aligns automatically at appropriate intervals)
+#define ll_aligned_malloc( size, align ) malloc(size)
+#define ll_aligned_free( ptr ) free(ptr)
+#define ll_aligned_malloc_16 malloc
+#define ll_aligned_free_16 free
+#define ll_aligned_malloc_32 malloc
+#define ll_aligned_free_32 free
+#endif // LL_DEBUG
 
 class LL_COMMON_API LLMemory
 {

File indra/llmath/llvolume.cpp

 	mProfilep = NULL;
 	mVolumeFaces.clear();
 
-	free(mHullPoints);
+	ll_aligned_free_16(mHullPoints);
 	mHullPoints = NULL;
-	free(mHullIndices);
+	ll_aligned_free_16(mHullIndices);
 	mHullIndices = NULL;
 }
 
 {
 	if (!mData)
 	{
-		mData = (LLVector4a*) malloc(sizeof(LLVector4a)*2);
+		mData = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*2);
 	}
 }
 
 
 LLVolumeFace::VertexData::~VertexData()
 {
-	free(mData);
+	ll_aligned_free_16(mData);
 	mData = NULL;
 }
 
 	mWeights(NULL),
 	mOctree(NULL)
 {
-	mExtents = (LLVector4a*) malloc(sizeof(LLVector4a)*3);
+	mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
 	mCenter = mExtents+2;
 }
 
 	mWeights(NULL),
 	mOctree(NULL)
 { 
-	mExtents = (LLVector4a*) malloc(sizeof(LLVector4a)*3);
+	mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
 	mCenter = mExtents+2;
 	*this = src;
 }
 		}
 		else
 		{
-			free(mBinormals);
+			ll_aligned_free_16(mBinormals);
 			mBinormals = NULL;
 		}
 
 		}
 		else
 		{
-			free(mWeights);
+			ll_aligned_free_16(mWeights);
 			mWeights = NULL;
 		}
 	}
 
 LLVolumeFace::~LLVolumeFace()
 {
-	free(mExtents);
+	ll_aligned_free_16(mExtents);
 	mExtents = NULL;
 
 	freeData();
 
 void LLVolumeFace::freeData()
 {
-	free(mPositions);
+	ll_aligned_free_16(mPositions);
 	mPositions = NULL;
-	free( mNormals);
+	ll_aligned_free_16( mNormals);
 	mNormals = NULL;
-	free(mTexCoords);
+	ll_aligned_free_16(mTexCoords);
 	mTexCoords = NULL;
-	free(mIndices);
+	ll_aligned_free_16(mIndices);
 	mIndices = NULL;
-	free(mBinormals);
+	ll_aligned_free_16(mBinormals);
 	mBinormals = NULL;
-	free(mWeights);
+	ll_aligned_free_16(mWeights);
 	mWeights = NULL;
 
 	delete mOctree;
 	
 	//allocate space for new buffer
 	S32 num_verts = mNumVertices;
-	LLVector4a* pos = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
-	LLVector4a* norm = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+	LLVector4a* pos = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
+	LLVector4a* norm = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 	S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;
-	LLVector2* tc = (LLVector2*) malloc(size);
+	LLVector2* tc = (LLVector2*) ll_aligned_malloc_16(size);
 
 	LLVector4a* wght = NULL;
 	if (mWeights)
 	{
-		wght = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+		wght = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 	}
 
 	LLVector4a* binorm = NULL;
 	if (mBinormals)
 	{
-		binorm = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+		binorm = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 	}
 
 	//allocate mapping of old indices to new indices
 		mIndices[i] = new_idx[mIndices[i]];
 	}
 	
-	free(mPositions);
-	free(mNormals);
-	free(mTexCoords);
-	free(mWeights);
-	free(mBinormals);
+	ll_aligned_free_16(mPositions);
+	ll_aligned_free_16(mNormals);
+	ll_aligned_free_16(mTexCoords);
+	ll_aligned_free_16(mWeights);
+	ll_aligned_free_16(mBinormals);
 
 	mPositions = pos;
 	mNormals = norm;
 
 void LLVolumeFace::resizeVertices(S32 num_verts)
 {
-	free(mPositions);
-	free(mNormals);
-	free(mBinormals);
-	free(mTexCoords);
+	ll_aligned_free_16(mPositions);
+	ll_aligned_free_16(mNormals);
+	ll_aligned_free_16(mBinormals);
+	ll_aligned_free_16(mTexCoords);
 
 	mBinormals = NULL;
 
 	if (num_verts)
 	{
-		mPositions = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+		mPositions = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 		assert_aligned(mPositions, 16);
-		mNormals = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+		mNormals = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 		assert_aligned(mNormals, 16);
 
 		//pad texture coordinate block end to allow for QWORD reads
 		S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;
-		mTexCoords = (LLVector2*) malloc(size);
+		mTexCoords = (LLVector2*) ll_aligned_malloc_16(size);
 		assert_aligned(mTexCoords, 16);
 	}
 	else
 	
 
 	//just clear binormals
-	free(mBinormals);
+	ll_aligned_free_16(mBinormals);
 	mBinormals = NULL;
 
 	mPositions[mNumVertices] = pos;
 
 void LLVolumeFace::allocateBinormals(S32 num_verts)
 {
-	free(mBinormals);
-	mBinormals = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+	ll_aligned_free_16(mBinormals);
+	mBinormals = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 }
 
 void LLVolumeFace::allocateWeights(S32 num_verts)
 {
-	free(mWeights);
-	mWeights = (LLVector4a*) malloc(sizeof(LLVector4a)*num_verts);
+	ll_aligned_free_16(mWeights);
+	mWeights = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 }
 
 void LLVolumeFace::resizeIndices(S32 num_indices)
 {
-	free(mIndices);
+	ll_aligned_free_16(mIndices);
 	
 	if (num_indices)
 	{
 		//pad index block end to allow for QWORD reads
 		S32 size = ((num_indices*sizeof(U16)) + 0xF) & ~0xF;
 		
-		mIndices = (U16*) malloc(size);
+		mIndices = (U16*) ll_aligned_malloc_16(size);
 	}
 	else
 	{

File indra/llrender/llshadermgr.cpp

 		}
 		else
 		{
-			LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
+			LL_INFOS("ShaderLoading") << log << LL_ENDL;
 		}
 	}
 }

File indra/llrender/llvertexbuffer.cpp

 	{
 		static int gl_buffer_idx = 0;
 		mGLBuffer = ++gl_buffer_idx;
-		mMappedData = (U8*) malloc(size);
+		mMappedData = (U8*) ll_aligned_malloc_16(size);
 	}
 }
 
 	}
 	else
 	{
-		mMappedIndexData = (U8*) malloc(size);
+		mMappedIndexData = (U8*) ll_aligned_malloc_16(size);
 		static int gl_buffer_idx = 0;
 		mGLIndices = ++gl_buffer_idx;
 	}
 		}
 		else
 		{
-			free(mMappedData);
+			ll_aligned_free_16(mMappedData);
 			mMappedData = NULL;
 			mEmpty = TRUE;
 		}
 		}
 		else
 		{
-			free(mMappedIndexData);
+			ll_aligned_free_16(mMappedIndexData);
 			mMappedIndexData = NULL;
 			mEmpty = TRUE;
 		}
 			{
 				if (!useVBOs())
 				{
-					free(mMappedData);
-					mMappedData = (U8*) malloc(newsize);
+					ll_aligned_free_16(mMappedData);
+					mMappedData = (U8*) ll_aligned_malloc_16(newsize);
 				}
 				mResized = TRUE;
 			}
 			{
 				if (!useVBOs())
 				{
-					free(mMappedIndexData);
-					mMappedIndexData = (U8*) malloc(new_index_size);
+					ll_aligned_free_16(mMappedIndexData);
+					mMappedIndexData = (U8*) ll_aligned_malloc_16(new_index_size);
 				}
 				mResized = TRUE;
 			}
 {
 	if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData))
 	{
-		free(mMappedData) ;
-		free(mMappedIndexData) ;
+		ll_aligned_free_16(mMappedData) ;
+		ll_aligned_free_16(mMappedIndexData) ;
 		mMappedData = NULL ;
 		mMappedIndexData = NULL ;
 	}
 {
 	if(!mMappedData)
 	{
-		mMappedData = (U8*)malloc(getSize());
+		mMappedData = (U8*)ll_aligned_malloc_16(getSize());
 	}
 }
 
 {
 	if(!mMappedIndexData)
 	{
-		mMappedIndexData = (U8*)malloc(getIndicesSize());
+		mMappedIndexData = (U8*)ll_aligned_malloc_16(getIndicesSize());
 	}
 }
 

File indra/llui/lltextbase.cpp

 	S32 first_line = getFirstVisibleLine();
 
 	// if scroll anchor not on first line, update it to first character of first line
-	if (!mLineInfoList.empty()
+	if ((first_line < mLineInfoList.size())
 		&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
 			||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
 	{

File indra/llwindow/llwindowmacosx.cpp

 				GLint fullscreenAttrib[] =
 				{
 					AGL_RGBA,
-						AGL_FULLSCREEN,
-						//			AGL_NO_RECOVERY,	// MBW -- XXX -- Not sure if we want this attribute
-						AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
-						AGL_SAMPLES_ARB, mFSAASamples,
-						AGL_DOUBLEBUFFER,
-						AGL_CLOSEST_POLICY,
-						AGL_ACCELERATED,
-						AGL_RED_SIZE, 8,
-						AGL_GREEN_SIZE, 8,
-						AGL_BLUE_SIZE, 8,
-						AGL_ALPHA_SIZE, 8,
-						AGL_DEPTH_SIZE, 24,
-						AGL_STENCIL_SIZE, 8,
-						AGL_NONE
+					AGL_FULLSCREEN,
+					AGL_NO_RECOVERY,
+					AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
+					AGL_SAMPLES_ARB, mFSAASamples,
+					AGL_DOUBLEBUFFER,
+					AGL_CLOSEST_POLICY,
+					AGL_ACCELERATED,
+					AGL_RED_SIZE, 8,
+					AGL_GREEN_SIZE, 8,
+					AGL_BLUE_SIZE, 8,
+					AGL_ALPHA_SIZE, 8,
+					AGL_DEPTH_SIZE, 24,
+					AGL_STENCIL_SIZE, 8,
+					AGL_NONE
 				};
 
 				LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL;
 			}
 			else
 			{
+				// NOTE from Leslie:
+				//
+				// AGL_NO_RECOVERY, when combined with AGL_ACCELERATED prevents software rendering
+				// fallback which means we won't hvae shaders that compile and link but then don't
+				// work.  The drawback is that our shader compilation will be a bit more finicky though.
+
 				GLint windowedAttrib[] =
 				{
 					AGL_RGBA,
-						AGL_DOUBLEBUFFER,
-						AGL_CLOSEST_POLICY,
-						AGL_ACCELERATED,
-						AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
-						AGL_SAMPLES_ARB, mFSAASamples,
-						AGL_RED_SIZE, 8,
-						AGL_GREEN_SIZE, 8,
-						AGL_BLUE_SIZE, 8,
-						AGL_ALPHA_SIZE, 8,
-						AGL_DEPTH_SIZE, 24,
-						AGL_STENCIL_SIZE, 8,
-						AGL_NONE
+					AGL_NO_RECOVERY,
+					AGL_DOUBLEBUFFER,
+					AGL_CLOSEST_POLICY,
+					AGL_ACCELERATED,
+					AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
+					AGL_SAMPLES_ARB, mFSAASamples,
+					AGL_RED_SIZE, 8,
+					AGL_GREEN_SIZE, 8,
+					AGL_BLUE_SIZE, 8,
+					AGL_ALPHA_SIZE, 8,
+					AGL_DEPTH_SIZE, 24,
+					AGL_STENCIL_SIZE, 8,
+					AGL_NONE
 				};
 
 				LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;

File indra/newview/app_settings/high_graphics.xml

 	<RenderAvatarCloth value="FALSE"/>
 	<!--Default for now-->
 	<RenderAvatarLODFactor value="1.0"/>
-  <!--Default for now-->
-  <RenderAvatarPhysicsLODFactor value="0.9"/>
+	<!--Default for now-->
+	<RenderAvatarPhysicsLODFactor value="0.9"/>
 	<!--NO SHADERS-->
 	<RenderAvatarVP value="TRUE"/>
 	<!--Short Range-->
 	<RenderFarClip value="128"/>
 	<!--Default for now-->
 	<RenderFlexTimeFactor value="1"/>
-	<!--256... but they don't use this-->
+	<!--256... but they do not use this-->
 	<RenderGlowResolutionPow value="9"/>
 	<!--Low number-->
 	<RenderMaxPartCount value="4096"/>
 	<VertexShaderEnable value="TRUE"/>
 	<!--NO SHADERS-->
 	<WindLightUseAtmosShaders value="TRUE"/>
-  <!--Deferred Shading-->
-  <RenderDeferred value="FALSE"/>
-  <!--SSAO Disabled-->
-  <RenderDeferredSSAO value="FALSE"/>
-  <!--Sun Shadows-->
-  <RenderShadowDetail value="0"/>
-
+	<!--Deferred Shading-->
+	<RenderDeferred value="FALSE"/>
+	<!--SSAO Disabled-->
+	<RenderDeferredSSAO value="FALSE"/>
+	<!--Sun Shadows-->
+	<RenderShadowDetail value="0"/>
 </settings>

File indra/newview/app_settings/low_graphics.xml

 	<RenderAvatarCloth value="FALSE"/>
 	<!--Default for now-->
 	<RenderAvatarLODFactor value="0.5"/>
-  <!--Default for now-->
-  <RenderAvatarPhysicsLODFactor value="0.0"/>
-  <!--Default for now-->
-  <RenderAvatarMaxVisible value="3"/>
+	<!--Default for now-->
+	<RenderAvatarPhysicsLODFactor value="0.0"/>
+	<!--Default for now-->
+	<RenderAvatarMaxVisible value="3"/>
 	<!--NO SHADERS-->
 	<RenderAvatarVP value="FALSE"/>
 	<!--Short Range-->
 	<RenderFarClip value="64"/>
 	<!--Default for now-->
 	<RenderFlexTimeFactor value="0.5"/>
-	<!--256... but they don't use this-->
+	<!--256... but they do not use this-->
 	<RenderGlowResolutionPow value="8"/>
 	<!--Low number-->
 	<RenderMaxPartCount value="1024"/>
 	<VertexShaderEnable value="FALSE"/>
 	<!--NO SHADERS-->
 	<WindLightUseAtmosShaders value="FALSE"/>
-  <!--No Deferred Shading-->
-  <RenderDeferred value="FALSE"/>
-  <!--SSAO Disabled-->
-  <RenderDeferredSSAO value="FALSE"/>
-  <!--No Shadows-->
-  <RenderShadowDetail value="0"/>
-
+	<!--No Deferred Shading-->
+	<RenderDeferred value="FALSE"/>
+	<!--SSAO Disabled-->
+	<RenderDeferredSSAO value="FALSE"/>
+	<!--No Shadows-->
+	<RenderShadowDetail value="0"/>
 </settings>

File indra/newview/app_settings/mid_graphics.xml

 	<RenderAvatarCloth value="FALSE"/>
 	<!--Default for now-->
 	<RenderAvatarLODFactor value="0.5"/>
-  <!--Default for now-->
-  <RenderAvatarPhysicsLODFactor value="0.75"/>
+	<!--Default for now-->
+	<RenderAvatarPhysicsLODFactor value="0.75"/>
 	<!--NO SHADERS-->
 	<RenderAvatarVP value="TRUE"/>
 	<!--Short Range-->
 	<RenderFarClip value="96"/>
 	<!--Default for now-->
 	<RenderFlexTimeFactor value="1"/>
-	<!--256... but they don't use this-->
+	<!--256... but they do not use this-->
 	<RenderGlowResolutionPow value="8"/>
 	<!--Low number-->
 	<RenderMaxPartCount value="2048"/>
 	<VertexShaderEnable value="TRUE"/>
 	<!--NO SHADERS-->
 	<WindLightUseAtmosShaders value="FALSE"/>
-  <!--No Deferred Shading-->
-  <RenderDeferred value="FALSE"/>
-  <!--SSAO Disabled-->
-  <RenderDeferredSSAO value="FALSE"/>
-  <!--No Shadows-->
-  <RenderShadowDetail value="0"/>
-
+	<!--No Deferred Shading-->
+	<RenderDeferred value="FALSE"/>
+	<!--SSAO Disabled-->
+	<RenderDeferredSSAO value="FALSE"/>
+	<!--No Shadows-->
+	<RenderShadowDetail value="0"/>
 </settings>

File indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl

-/** 
- * @file avatarAlphaF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * $/LicenseInfo$
- */
-
-#version 120
-
-uniform sampler2D diffuseMap;
-uniform sampler2DShadow shadowMap0;
-uniform sampler2DShadow shadowMap1;
-uniform sampler2DShadow shadowMap2;
-uniform sampler2DShadow shadowMap3;
-uniform sampler2D noiseMap;
-
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-
-vec3 atmosLighting(vec3 light);
-vec3 scaleSoftClip(vec3 light);
-
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec4 vary_position;
-varying vec3 vary_normal;
-
-void main() 
-{
-	float shadow = 1.0;
-	vec4 pos = vary_position;
-	vec3 norm = normalize(vary_normal);
-	
-	vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz;
-
-	if (pos.z > -shadow_clip.w)
-	{	
-		
-		if (pos.z < -shadow_clip.z)
-		{
-			vec4 lpos = shadow_matrix[3]*pos;
-			shadow = shadow2DProj(shadowMap3, lpos).x;
-		}
-		else if (pos.z < -shadow_clip.y)
-		{
-			vec4 lpos = shadow_matrix[2]*pos;
-			shadow = shadow2DProj(shadowMap2, lpos).x;
-		}
-		else if (pos.z < -shadow_clip.x)
-		{
-			vec4 lpos = shadow_matrix[1]*pos;
-			shadow = shadow2DProj(shadowMap1, lpos).x;
-		}
-		else
-		{
-			vec4 lpos = shadow_matrix[0]*pos;
-			shadow = shadow2DProj(shadowMap0, lpos).x;
-		}
-	}
-	
-	
-	vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);	
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col;
-	
-	color.rgb = atmosLighting(color.rgb);
-
-	color.rgb = scaleSoftClip(color.rgb);
-
-	gl_FragColor = color;
-}

File indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl

 varying vec3 vary_position;
 varying vec3 vary_ambient;
 varying vec3 vary_directional;
-varying vec3 vary_normal;
 varying vec3 vary_fragcoord;
+varying vec3 vary_pointlight_col;
 
 uniform float near_clip;
 
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = length(lv);
+	
+	//normalize light vector
+	lv *= 1.0/d;
+	
+	//distance attenuation
+	float dist2 = d*d/(la*la);
+	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
+	// spotlight coefficient.
+	float spot = max(dot(-ln, lv), is_pointlight);
+	da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+	//angular attenuation
+	da *= calcDirectionalLight(n, lv);
+
+	return da;	
+}
+
 void main()
 {
 	gl_TexCoord[0] = gl_MultiTexCoord0;
 	gl_Position = frag_pos;
 	
 	vary_position = pos.xyz;
-	vary_normal = norm;	
 	
 	calcAtmospherics(pos.xyz);
 
 
 	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
 
-	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-	col.rgb = scaleDownLight(col.rgb);
+	// Collect normal lights
+	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
+	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
+	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
+	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
+	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
+	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
 	
+	vary_pointlight_col = col.rgb*gl_Color.rgb;
+
+	col.rgb = vec3(0,0,0);
+
 	// Add windlight lights
-	col.rgb += atmosAmbient(vec3(0.));
+	col.rgb = atmosAmbient(vec3(0.));
 	
 	vary_ambient = col.rgb*gl_Color.rgb;
 	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));

File indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl

+/** 
+ * @file multiPointLightV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+#version 120
+
+varying vec4 vary_fragcoord;
+
+void main()
+{
+	//transform vertex
+	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+	vary_fragcoord = pos;
+
+	gl_Position = pos;
+	gl_FrontColor = gl_Color;
+}

File indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl

 uniform sampler2DRect normalMap;
 uniform sampler2D noiseMap;
 
-uniform sampler2D		lightFunc;
-
 
 // Inputs
 uniform mat4 shadow_matrix[6];

File indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl

-/** 
- * @file avatarAlphaF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * $/LicenseInfo$
- */
- 
-#version 120
-
-#extension GL_ARB_texture_rectangle : enable
-
-uniform sampler2D diffuseMap;
-uniform sampler2DRectShadow shadowMap0;
-uniform sampler2DRectShadow shadowMap1;
-uniform sampler2DRectShadow shadowMap2;
-uniform sampler2DRectShadow shadowMap3;
-uniform sampler2D noiseMap;
-
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform vec2 screen_res;
-uniform vec2 shadow_res;
-
-vec3 atmosLighting(vec3 light);
-vec3 scaleSoftClip(vec3 light);
-
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_position;
-varying vec3 vary_normal;
-
-uniform float shadow_bias;
-
-float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
-{
-	stc.xyz /= stc.w;
-	stc.z += shadow_bias;
-	
-	float cs = shadow2DRect(shadowMap, stc.xyz).x;
-	float shadow = cs;
-
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
-	shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
-			
-	return shadow/5.0;
-}
-
-void main() 
-{
-	float shadow = 1.0;
-	vec4 pos = vec4(vary_position, 1.0);
-	vec3 norm = normalize(vary_normal);
-	
-	//vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz;
-
-	vec4 spos = pos;
-	
-	if (spos.z > -shadow_clip.w)
-	{	
-		vec4 lpos;
-		
-		if (spos.z < -shadow_clip.z)
-		{
-			lpos = shadow_matrix[3]*spos;
-			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap3, lpos, 1.5);
-			shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
-		}
-		else if (spos.z < -shadow_clip.y)
-		{
-			lpos = shadow_matrix[2]*spos;
-			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap2, lpos, 1.5);
-		}
-		else if (spos.z < -shadow_clip.x)
-		{
-			lpos = shadow_matrix[1]*spos;
-			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap1, lpos, 1.5);
-		}
-		else
-		{
-			lpos = shadow_matrix[0]*spos;
-			lpos.xy *= shadow_res;
-			shadow = pcfShadow(shadowMap0, lpos, 1.5);
-		}
-	}
-	
-	
-	vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a);	
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col;
-	
-	color.rgb = atmosLighting(color.rgb);
-
-	color.rgb = scaleSoftClip(color.rgb);
-
-	gl_FragColor = color;
-}

File indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl

 varying vec3 vary_position;
 varying vec3 vary_ambient;
 varying vec3 vary_directional;
-varying vec3 vary_normal;
 varying vec3 vary_fragcoord;
+varying vec3 vary_pointlight_col;
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = length(lv);
+	
+	//normalize light vector
+	lv *= 1.0/d;
+	
+	//distance attenuation
+	float dist2 = d*d/(la*la);
+	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
+	// spotlight coefficient.
+	float spot = max(dot(-ln, lv), is_pointlight);
+	da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+	//angular attenuation
+	da *= calcDirectionalLight(n, lv);
+
+	return da;	
+}
+
 void main()
 {
 	gl_TexCoord[0] = gl_MultiTexCoord0;
 	
 	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
 	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
-	vary_normal = norm;	
 	
 	calcAtmospherics(pos.xyz);
 
 
 	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
 
-	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-	col.rgb = scaleDownLight(col.rgb);
+	// Collect normal lights
+	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
+	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
+	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
+	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
+	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
+	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
 	
+	vary_pointlight_col = col.rgb*gl_Color.rgb;
+
+	col.rgb = vec3(0,0,0);
+
 	// Add windlight lights
-	col.rgb += atmosAmbient(vec3(0.));
+	col.rgb = atmosAmbient(vec3(0.));
 	
 	vary_ambient = col.rgb*gl_Color.rgb;
 	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));

File indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl

 uniform sampler2DRectShadow shadowMap3;
 uniform sampler2DShadow shadowMap4;
 uniform sampler2DShadow shadowMap5;
-uniform sampler2D noiseMap;
-
-uniform sampler2D		lightFunc;
 
 
 // Inputs

File indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl

 uniform sampler2DShadow shadowMap5;
 uniform sampler2D noiseMap;
 
-uniform sampler2D		lightFunc;
-
 // Inputs
 uniform mat4 shadow_matrix[6];
 uniform vec4 shadow_clip;

File indra/newview/app_settings/ultra_graphics.xml

 	<RenderAvatarCloth value="TRUE"/>
 	<!--Default for now-->
 	<RenderAvatarLODFactor value="1.0"/>
-  <!--Default for now-->
-  <RenderAvatarPhysicsLODFactor value="1.0"/>
+	<!--Default for now-->
+	<RenderAvatarPhysicsLODFactor value="1.0"/>
 	<!--NO SHADERS-->
 	<RenderAvatarVP value="TRUE"/>
 	<!--Short Range-->
 	<RenderFarClip value="256"/>
 	<!--Default for now-->
 	<RenderFlexTimeFactor value="1"/>
-	<!--256... but they don't use this-->
+	<!--256... but they do not use this-->
 	<RenderGlowResolutionPow value="9"/>
 	<!--Low number-->
 	<RenderMaxPartCount value="4096"/>
 	<VertexShaderEnable value="TRUE"/>
 	<!--NO SHADERS-->
 	<WindLightUseAtmosShaders value="TRUE"/>
-  <!--Deferred Shading-->
-  <RenderDeferred value="TRUE"/>
-  <!--SSAO Enabled-->
-  <RenderDeferredSSAO value="TRUE"/>
-  <!--Full Shadows-->
-  <RenderShadowDetail value="2"/>
-
+	<!--Deferred Shading-->
+	<RenderDeferred value="TRUE"/>
+	<!--SSAO Enabled-->
+	<RenderDeferredSSAO value="TRUE"/>
+	<!--Full Shadows-->
+	<RenderShadowDetail value="2"/>
 </settings>

File indra/newview/featuretable_mac.txt

-version 22
+version 23
 
 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences
 // Should be combined into one table
 //
 list all
 RenderAnisotropic				1	0
-RenderAvatarCloth				0	0
+RenderAvatarCloth				1	1
 RenderAvatarLODFactor			1	1.0
 RenderAvatarPhysicsLODFactor 1	1.0
 RenderAvatarMaxVisible          1   12
-RenderAvatarVP					1	0
+RenderAvatarVP					1	1
 RenderCubeMap					1	1
 RenderDelayVBUpdate				1	0
 RenderFarClip					1	256
 RenderMaxPartCount				1	8192
 RenderNightBrightness			1	1.0
 RenderObjectBump				1	1
-RenderReflectionDetail			1	3
+RenderReflectionDetail			1	4
 RenderTerrainDetail				1	1
 RenderTerrainLODFactor			1	2.0
 RenderTransparentWater			1	1
 RenderUseImpostors				1	1
 RenderVBOEnable					1	1
 RenderVolumeLODFactor			1	2.0
-RenderWaterReflections			1	1
+UseStartScreen				1	1
 UseOcclusion					1	1
 VertexShaderEnable				1	1
 WindLightUseAtmosShaders		1	1
 WLSkyDetail						1	128
-RenderUseCleverUI				1	1
 Disregard128DefaultDrawDistance	1	1
 Disregard96DefaultDrawDistance	1	1
 RenderTextureMemoryMultiple		1	0.5
-Disregard128DefaultDrawDistance	1	1
-Disregard96DefaultDrawDistance	1	1
+RenderShaderLightingMaxLevel	1	3
 SkyUseClassicClouds			1	1
-WatchdogDisabled				1	1
 RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
-
+WatchdogDisabled				1	1
+RenderUseStreamVBO			1	1
 
 //
 // Low Graphics Settings
 RenderTreeLODFactor			1	0
 RenderUseImpostors			1	1
 RenderVolumeLODFactor		1	0.5
-RenderWaterReflections		1	0
 VertexShaderEnable			1	0
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
 SkyUseClassicClouds			1	0
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
-RenderShadowDetail			1	2
-
+RenderShadowDetail			1	0
 
 //
 // Mid Graphics Settings
 RenderTreeLODFactor			1	0.5
 RenderUseImpostors			1	1
 RenderVolumeLODFactor		1	1.125
-RenderWaterReflections		1	0
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
-RenderShadowDetail			1	2
-
+RenderShadowDetail			1	0
 
 //
 // High Graphics Settings (purty)
 RenderTreeLODFactor			1	0.5
 RenderUseImpostors			1	1
 RenderVolumeLODFactor		1	1.125
-RenderWaterReflections		1	0
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	1
 WLSkyDetail					1	48
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
 
-
 //
 // Ultra graphics (REALLY PURTY!)
 //
 RenderLocalLights			1	1
 RenderMaxPartCount			1	8192
 RenderObjectBump			1	1
-RenderReflectionDetail		1	3
+RenderReflectionDetail		1	4
 RenderTerrainDetail			1	1
 RenderTerrainLODFactor		1	2.0
 RenderTransparentWater		1	1
 RenderTreeLODFactor			1	1.0
 RenderUseImpostors			1	1
 RenderVolumeLODFactor		1	2.0
-RenderWaterReflections		1	1
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	1
 WLSkyDetail					1	128
 RenderDeferredSSAO			1	0
 RenderShadowDetail			1	2
 
-
 //
 // Class Unknown Hardware (unknown)
 //
 list NoPixelShaders
 RenderAvatarVP				0	0
 RenderAvatarCloth			0	0
-RenderWaterReflections		0	0
+RenderReflectionDetail		0	0
 VertexShaderEnable			0	0
 WindLightUseAtmosShaders	0	0
+RenderDeferred				0	0
+RenderDeferredSSAO			0	0
+RenderShadowDetail			0	0
 
 //
 // No Vertex Shaders available
 list NoVertexShaders
 RenderAvatarVP				0	0
 RenderAvatarCloth			0	0
-RenderWaterReflections		0	0
+RenderReflectionDetail		0	0
 VertexShaderEnable			0	0
 WindLightUseAtmosShaders	0	0
+RenderDeferred				0	0
+RenderDeferredSSAO			0	0
+RenderShadowDetail			0	0
 
+//
 // "Default" setups for safe, low, medium, high
 //
 list safe
 RenderTerrainDetail 		1	0
 RenderUseImpostors			0	0
 RenderVBOEnable				1	0
-RenderWaterReflections		0	0
+RenderReflectionDetail		0	0
 WindLightUseAtmosShaders	0	0
+RenderDeferred				0	0
+RenderDeferredSSAO			0	0
+RenderShadowDetail			0	0
 
 //
 // CPU based feature masks
 list OpenGLPre15
 RenderVBOEnable				1	0
 
+list TexUnit8orLess
+RenderDeferredSSAO			0	0
+
 list Intel
 RenderAnisotropic			1	0
 RenderLocalLights			1	0

File indra/newview/featuretable_xp.txt

 WLSkyDetail					1	48
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
-RenderShadowDetail			1	0
+RenderShadowDetail			1	2
 
 //
 // Ultra graphics (REALLY PURTY!)
 WLSkyDetail					1	128
 RenderDeferred				1	0
 RenderDeferredSSAO			1	0
-RenderShadowDetail			1	0
+RenderShadowDetail			1	2
 
 //
 // Class Unknown Hardware (unknown)

File indra/newview/lldrawpoolsky.cpp

 
 void LLDrawPoolSky::render(S32 pass)
 {
+	gGL.flush();
+
 	if (mDrawFace.empty())
 	{
 		return;
 
 	S32 face_count = (S32)mDrawFace.size();
 
+	LLVertexBuffer::unbind();
+	glColor4f(1,1,1,1);
+
 	for (S32 i = 0; i < llmin(6, face_count); ++i)
 	{
 		renderSkyCubeFace(i);
 	}
 
-	LLGLEnable blend(GL_BLEND);
-
 	glPopMatrix();
 }
 

File indra/newview/llfeaturemanager.cpp

 	{
 		maskFeatures("OpenGLPre30");
 	}
+	if (gGLManager.mNumTextureUnits <= 8)
+	{
+		maskFeatures("TexUnit8orLess");
+	}
 
 	// now mask by gpu string
 	// Replaces ' ' with '_' in mGPUString to deal with inability for parser to handle spaces

File indra/newview/llfloaterpreference.cpp

 	LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
 	// Avatar Render Mode
 	LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
+	
+	bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP");
+	if (LLViewerShaderMgr::sInitialized)
+	{
+		S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel;
+		avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE;
+	}
 
-	S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel;
-	ctrl_avatar_vp->setEnabled((max_avatar_shader > 0) ? TRUE : FALSE);
+	ctrl_avatar_vp->setEnabled(avatar_vp_enabled);
 	
 	if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE || 
 		gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
 	LLCheckBoxCtrl* ctrl_shader_enable   = getChild<LLCheckBoxCtrl>("BasicShaders");
 	// radio set for terrain detail mode
 	LLRadioGroup*   mRadioTerrainDetail = getChild<LLRadioGroup>("TerrainDetailRadio");   // can be linked with control var
-
+	
 	ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"));
 	
 	BOOL shaders = ctrl_shader_enable->get();

File indra/newview/llpolymesh.cpp

 		int nverts = mSharedData->mNumVertices;
 		int nfloats = nverts * (2*4 + 3*3 + 2 + 4);
 		//use 16 byte aligned vertex data to make LLPolyMesh SSE friendly
-		mVertexData = (F32*) malloc(nfloats*4);
+		mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4);
 		int offset = 0;
 		mCoords				= 	(LLVector4*)(mVertexData + offset); offset += 4*nverts;
 		mNormals			=	(LLVector4*)(mVertexData + offset); offset += 4*nverts;
                 mJointRenderData[i] = NULL;
         }
 
-		free(mVertexData);
+		ll_aligned_free_16(mVertexData);
 
 }
 

File indra/newview/llspatialpartition.cpp

 					LLConvexDecomposition::getInstance()->generateSingleHullMeshFromMesh( &mesh, &res );
 
 					//copy res into phys_volume
-					phys_volume->mHullPoints = (LLVector4a*) malloc(sizeof(LLVector4a)*res.mNumVertices);
+					phys_volume->mHullPoints = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*res.mNumVertices);
 					phys_volume->mNumHullPoints = res.mNumVertices;
 
 					S32 idx_size = (res.mNumTriangles*3*2+0xF) & ~0xF;
-					phys_volume->mHullIndices = (U16*) malloc(idx_size);
+					phys_volume->mHullIndices = (U16*) ll_aligned_malloc_16(idx_size);
 					phys_volume->mNumHullIndices = res.mNumTriangles*3;
 
 					const F32* v = res.mVertexBase;

File indra/newview/llviewershadermgr.cpp

 	{
 		gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader";
 		gDeferredMultiLightProgram.mShaderFiles.clear();
-		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
+		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
 		gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
 		success = gDeferredMultiLightProgram.createShader(NULL, NULL);

File indra/newview/llvosky.cpp

 
 void LLSkyTex::bindTexture(BOOL curr)
 {
-	gGL.getTexUnit(0)->bind(mTexture[getWhich(curr)]);
+	gGL.getTexUnit(0)->bind(mTexture[getWhich(curr)], true);
 }
 
 /***************************************