diff options
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/llglslshader.cpp | 21 | ||||
| -rw-r--r-- | indra/llrender/llglslshader.h | 1 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 5 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 265 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.h | 53 | 
5 files changed, 225 insertions, 120 deletions
| diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 6b2852670a..3773568ad8 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -64,10 +64,23 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)  }  LLShaderFeatures::LLShaderFeatures() -: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false), -hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false), -hasGamma(false), hasLighting(false), isAlphaLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false), -hasAlphaMask(false) +	: atmosphericHelpers(false) +	, calculatesLighting(false) +	, calculatesAtmospherics(false) +	, hasLighting(false) +	, isAlphaLighting(false) +	, isShiny(false) +	, isFullbright(false) +	, isSpecular(false) +	, hasWaterFog(false) +	, hasTransport(false) +	, hasSkinning(false) +	, hasObjectSkinning(false) +	, hasAtmospherics(false) +	, hasGamma(false) +	, mIndexedTextureChannels(0) +	, disableTextureIndex(false) +	, hasAlphaMask(false)  {  } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 00b4b0dbd4..7873fe3c4e 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -33,6 +33,7 @@  class LLShaderFeatures  {  public: +	bool atmosphericHelpers;  	bool calculatesLighting;  	bool calculatesAtmospherics;  	bool hasLighting; // implies no transport (it's possible to have neither though) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 1a03aeebb7..908443e8cf 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -94,13 +94,16 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)  		}  	} -	if (features->calculatesLighting) +	if (features->calculatesLighting || features->atmosphericHelpers)  	{  		if (!shader->attachObject("windlight/atmosphericsHelpersV.glsl"))  		{  			return FALSE;  		} +	} +	if (features->calculatesLighting) +	{  		if (features->isSpecular)  		{  			if (!shader->attachObject("lighting/lightFuncSpecularV.glsl")) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index eb302392bb..230c1faa40 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -53,31 +53,31 @@ U32 nhpo2(U32 v)  //============================================================================  //static -LLVBOPool LLVertexBuffer::sStreamVBOPool; -LLVBOPool LLVertexBuffer::sDynamicVBOPool; -LLVBOPool LLVertexBuffer::sStreamIBOPool; -LLVBOPool LLVertexBuffer::sDynamicIBOPool; +LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB); +LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB); +LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB); +LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);  U32 LLVBOPool::sBytesPooled = 0; -LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL ; +LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL;  U32 LLVertexBuffer::sBindCount = 0;  U32 LLVertexBuffer::sSetCount = 0;  S32 LLVertexBuffer::sCount = 0;  S32 LLVertexBuffer::sGLCount = 0;  S32 LLVertexBuffer::sMappedCount = 0; -BOOL LLVertexBuffer::sDisableVBOMapping = FALSE ; -BOOL LLVertexBuffer::sEnableVBOs = TRUE; +bool LLVertexBuffer::sDisableVBOMapping = false; +bool LLVertexBuffer::sEnableVBOs = true;  U32 LLVertexBuffer::sGLRenderBuffer = 0;  U32 LLVertexBuffer::sGLRenderArray = 0;  U32 LLVertexBuffer::sGLRenderIndices = 0;  U32 LLVertexBuffer::sLastMask = 0; -BOOL LLVertexBuffer::sVBOActive = FALSE; -BOOL LLVertexBuffer::sIBOActive = FALSE; +bool LLVertexBuffer::sVBOActive = false; +bool LLVertexBuffer::sIBOActive = false;  U32 LLVertexBuffer::sAllocatedBytes = 0; -BOOL LLVertexBuffer::sMapped = FALSE; -BOOL LLVertexBuffer::sUseStreamDraw = TRUE; -BOOL LLVertexBuffer::sUseVAO = FALSE; -BOOL LLVertexBuffer::sPreferStreamDraw = FALSE; +bool LLVertexBuffer::sMapped = false; +bool LLVertexBuffer::sUseStreamDraw = true; +bool LLVertexBuffer::sUseVAO = false; +bool LLVertexBuffer::sPreferStreamDraw = false;  const U32 FENCE_WAIT_TIME_NANOSECONDS = 10000;  //1 ms @@ -204,15 +204,26 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)  	Record rec;  	rec.mGLName = name;  	rec.mClientData = buffer; +<<<<<<< local +=======  	sBytesPooled += size; +>>>>>>> other +<<<<<<< local +	if (buffer == NULL) +=======  	if (!LLVertexBuffer::sDisableVBOMapping && mUsage == GL_DYNAMIC_DRAW_ARB) +>>>>>>> other  	{  		glDeleteBuffersARB(1, &rec.mGLName);  	}  	else  	{ +<<<<<<< local +		sBytesPooled += size; +======= +>>>>>>> other  		mFreeList[i].push_back(rec);  	}  } @@ -283,7 +294,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)  {  	if (sLastMask != data_mask)  	{ -		BOOL error = FALSE; +		bool error = false;  		if (LLGLSLShader::sNoFixedFunction)  		{ @@ -344,7 +355,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)  						{  							if (gDebugSession)  							{ -								error = TRUE; +								error = true;  								gFailLog << "Bad client state! " << array[i] << " disabled." << std::endl;  							}  							else @@ -364,7 +375,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)  					{ //needs to be disabled, make sure it was (DEBUG TEMPORARY)  						if (gDebugSession)  						{ -							error = TRUE; +							error = true;  							gFailLog << "Bad client state! " << array[i] << " enabled." << std::endl;  						}  						else @@ -548,7 +559,11 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of  void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const  {  	validateRange(start, end, count, indices_offset); +<<<<<<< local +	mMappable = false; +=======  	mMappable = FALSE; +>>>>>>> other  	gGL.syncMatrices();  	llassert(mNumVerts >= 0); @@ -603,7 +618,11 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi  void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const  {  	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); +<<<<<<< local +	mMappable = false; +=======  	mMappable = FALSE; +>>>>>>> other  	gGL.syncMatrices();  	llassert(mNumIndices >= 0); @@ -649,7 +668,11 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const  void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const  {  	llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); +<<<<<<< local +	mMappable = false; +=======  	mMappable = FALSE; +>>>>>>> other  	gGL.syncMatrices();  	llassert(mNumVerts >= 0); @@ -689,23 +712,13 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const  //static  void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)  { -	sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject ; -	sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ; +	sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject; +	sDisableVBOMapping = sEnableVBOs && no_vbo_mapping; -	if(!sPrivatePoolp) +	if (!sPrivatePoolp)  	{  -		sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ; +		sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC);  	} - -	sStreamVBOPool.mType = GL_ARRAY_BUFFER_ARB; -	sStreamVBOPool.mUsage= GL_STREAM_DRAW_ARB; -	sStreamIBOPool.mType = GL_ELEMENT_ARRAY_BUFFER_ARB; -	sStreamIBOPool.mUsage= GL_STREAM_DRAW_ARB; - -	sDynamicVBOPool.mType = GL_ARRAY_BUFFER_ARB; -	sDynamicVBOPool.mUsage= GL_DYNAMIC_DRAW_ARB; -	sDynamicIBOPool.mType = GL_ELEMENT_ARRAY_BUFFER_ARB; -	sDynamicIBOPool.mUsage= GL_DYNAMIC_DRAW_ARB;  }  //static  @@ -718,18 +731,18 @@ void LLVertexBuffer::unbind()  #endif  		sGLRenderArray = 0;  		sGLRenderIndices = 0; -		sIBOActive = FALSE; +		sIBOActive = false;  	}  	if (sVBOActive)  	{  		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); -		sVBOActive = FALSE; +		sVBOActive = false;  	}  	if (sIBOActive)  	{  		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); -		sIBOActive = FALSE; +		sIBOActive = false;  	}  	sGLRenderBuffer = 0; @@ -758,30 +771,83 @@ void LLVertexBuffer::cleanupClass()  //---------------------------------------------------------------------------- +S32 LLVertexBuffer::determineUsage(S32 usage) +{ +	S32 ret_usage = usage; + +	if (!sEnableVBOs) +	{ +		ret_usage = 0; +	} +	 +	if (usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw) +	{ +		ret_usage = 0; +	} +	 +	if (usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw) +	{ +		ret_usage = GL_STREAM_DRAW_ARB; +	} +	 +	if (usage == 0 && LLRender::sGLCoreProfile) +	{ //MUST use VBOs for all rendering +		ret_usage = GL_STREAM_DRAW_ARB; +	} +	 +	if (usage && usage != GL_STREAM_DRAW_ARB) +	{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default +		if (sDisableVBOMapping) +		{ //always use stream draw if VBO mapping is disabled +			ret_usage = GL_STREAM_DRAW_ARB; +		} +		else +		{ +			ret_usage = GL_DYNAMIC_DRAW_ARB; +		} +	} +	 +	return ret_usage; +} +  LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :  	LLRefCount(),  	mNumVerts(0),  	mNumIndices(0), -	mUsage(usage), +	mAlignedOffset(0), +	mAlignedIndexOffset(0), +	mSize(0), +	mIndicesSize(0), +	mTypeMask(typemask), +	mUsage(LLVertexBuffer::determineUsage(usage)),  	mGLBuffer(0), +	mGLIndices(0),  	mGLArray(0), -	mGLIndices(0),   	mMappedData(NULL), -	mMappedIndexData(NULL),  -	mVertexLocked(FALSE), -	mIndexLocked(FALSE), -	mFinal(FALSE), -	mEmpty(TRUE), +	mMappedIndexData(NULL), +	mMappedDataUsingVBOs(false), +	mMappedIndexDataUsingVBOs(false), +	mVertexLocked(false), +	mIndexLocked(false), +	mFinal(false), +	mEmpty(true), +	mMappable(false),  	mFence(NULL)  {  	LLMemType mt2(LLMemType::MTYPE_VERTEX_CONSTRUCTOR); -	mFence = NULL; -	if (!sEnableVBOs) + +	if (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping)  	{ -		mUsage = 0 ;  +		mMappable = true; +	} +	else +	{ +		mMappable = false;  	} +<<<<<<< local +=======  	if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)  	{  		mUsage = 0; @@ -819,18 +885,13 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :  		mMappable = FALSE;  	} +>>>>>>> other  	//zero out offsets  	for (U32 i = 0; i < TYPE_MAX; i++)  	{  		mOffsets[i] = 0;  	} -	mTypeMask = typemask; -	mSize = 0; -	mIndicesSize = 0; -	mAlignedOffset = 0; -	mAlignedIndexOffset = 0; -  	sCount++;  } @@ -1011,9 +1072,11 @@ void LLVertexBuffer::createGLBuffer(U32 size)  		return;  	} -	mEmpty = TRUE; +	mEmpty = true; -	if (useVBOs()) +	mMappedDataUsingVBOs = useVBOs(); +	 +	if (mMappedDataUsingVBOs)  	{  		genBuffer(size);  	} @@ -1040,12 +1103,14 @@ void LLVertexBuffer::createGLIndices(U32 size)  		return;  	} -	mEmpty = TRUE; +	mEmpty = true;  	//pad by 16 bytes for aligned copies  	size += 16; -	if (useVBOs()) +	mMappedIndexDataUsingVBOs = useVBOs(); + +	if (mMappedIndexDataUsingVBOs)  	{  		//pad by another 16 bytes for VBO pointer adjustment  		size += 16; @@ -1065,15 +1130,19 @@ void LLVertexBuffer::destroyGLBuffer()  	LLMemType mt2(LLMemType::MTYPE_VERTEX_DESTROY_BUFFER);  	if (mGLBuffer)  	{ -		if (useVBOs()) +		if (mMappedDataUsingVBOs)  		{  			releaseBuffer();  		}  		else  		{ +<<<<<<< local +			FREE_MEM(sPrivatePoolp, (void*) mMappedData); +=======  			FREE_MEM(sPrivatePoolp, (void*) mMappedData) ; +>>>>>>> other  			mMappedData = NULL; -			mEmpty = TRUE; +			mEmpty = true;  		}  	} @@ -1086,15 +1155,19 @@ void LLVertexBuffer::destroyGLIndices()  	LLMemType mt2(LLMemType::MTYPE_VERTEX_DESTROY_INDICES);  	if (mGLIndices)  	{ -		if (useVBOs()) +		if (mMappedIndexDataUsingVBOs)  		{  			releaseIndices();  		}  		else  		{ +<<<<<<< local +			FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData); +=======  			FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData) ; +>>>>>>> other  			mMappedIndexData = NULL; -			mEmpty = TRUE; +			mEmpty = true;  		}  	} @@ -1279,16 +1352,10 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)  	}  } -BOOL LLVertexBuffer::useVBOs() const +bool LLVertexBuffer::useVBOs() const  {  	//it's generally ineffective to use VBO for things that are streaming on apple -		 -	if (!mUsage) -	{ -		return FALSE; -	} - -	return TRUE; +	return (mUsage != 0);  }  //---------------------------------------------------------------------------- @@ -1368,7 +1435,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo  		if (!mVertexLocked)  		{  			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES); -			mVertexLocked = TRUE; +			mVertexLocked = true;  			sMappedCount++;  			stop_glerror();	 @@ -1447,8 +1514,8 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo  			{  				log_glerror(); -			//check the availability of memory -			LLMemory::logMemoryInfo(TRUE) ;  +				//check the availability of memory +				LLMemory::logMemoryInfo(true) ;   				if(mMappable)  				{			 @@ -1547,7 +1614,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range  		{  			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES); -			mIndexLocked = TRUE; +			mIndexLocked = true;  			sMappedCount++;  			stop_glerror();	 @@ -1626,7 +1693,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range  		if (!mMappedIndexData)  		{  			log_glerror(); -			LLMemory::logMemoryInfo(TRUE) ; +			LLMemory::logMemoryInfo(true) ;  			if(mMappable)  			{ @@ -1742,7 +1809,7 @@ void LLVertexBuffer::unmapBuffer()  			mMappedData = NULL;  		} -		mVertexLocked = FALSE ; +		mVertexLocked = false;  		sMappedCount--;  	} @@ -1809,13 +1876,13 @@ void LLVertexBuffer::unmapBuffer()  			mMappedIndexData = NULL ;  		} -		mIndexLocked = FALSE ; +		mIndexLocked = false ;  		sMappedCount--;  	}  	if(updated_all)  	{ -		mEmpty = FALSE; +		mEmpty = false;  	}  } @@ -1835,12 +1902,12 @@ template <class T,S32 type> struct VertexBufferStrider  			if (ptr == NULL)  			{  				llwarns << "mapIndexBuffer failed!" << llendl; -				return FALSE; +				return false;  			}  			strider = (T*)ptr;  			strider.setStride(0); -			return TRUE; +			return true;  		}  		else if (vbo.hasDataType(type))  		{ @@ -1851,18 +1918,18 @@ template <class T,S32 type> struct VertexBufferStrider  			if (ptr == NULL)  			{  				llwarns << "mapVertexBuffer failed!" << llendl; -				return FALSE; +				return false;  			}  			strider = (T*)ptr;  			strider.setStride(stride); -			return TRUE; +			return true;  		}  		else  		{  			llerrs << "VertexBufferStrider could not find valid vertex data." << llendl;  		} -		return FALSE; +		return false;  	}  }; @@ -1961,7 +2028,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)  		glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);  		sGLRenderBuffer = mGLBuffer;  		sBindCount++; -		sVBOActive = TRUE; +		sVBOActive = true;  		if (mGLArray)  		{ @@ -1993,7 +2060,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)  		sGLRenderIndices = mGLIndices;  		stop_glerror();  		sBindCount++; -		sIBOActive = TRUE; +		sIBOActive = true;  		ret = true;  	} @@ -2015,7 +2082,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  	LLMemType mt2(LLMemType::MTYPE_VERTEX_SET_BUFFER);  	//set up pointers if the data mask is different ... -	BOOL setup = (sLastMask != data_mask); +	bool setup = (sLastMask != data_mask);  	if (gDebugGL && data_mask != 0)  	{ //make sure data requirements are fulfilled @@ -2049,21 +2116,17 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  		if (mGLArray)  		{  			bindGLArray(); -			setup = FALSE; //do NOT perform pointer setup if using VAO +			setup = false; //do NOT perform pointer setup if using VAO  		}  		else  		{ -			if (bindGLBuffer()) -			{ -				setup = TRUE; -			} -			if (bindGLIndices()) -			{ -				setup = TRUE; -			} +			const bool bindBuffer = bindGLBuffer(); +			const bool bindIndices = bindGLIndices(); +			 +			setup = setup || bindBuffer || bindIndices;  		} -		BOOL error = FALSE; +		bool error = false;  		if (gDebugGL && !mGLArray)  		{  			GLint buff; @@ -2072,7 +2135,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  			{  				if (gDebugSession)  				{ -					error = TRUE; +					error = true;  					gFailLog << "Invalid GL vertex buffer bound: " << buff << std::endl;  				}  				else @@ -2088,7 +2151,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  				{  					if (gDebugSession)  					{ -						error = TRUE; +						error = true;  						gFailLog << "Invalid GL index buffer bound: " << buff <<  std::endl;  					}  					else @@ -2110,7 +2173,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  #endif  			sGLRenderArray = 0;  			sGLRenderIndices = 0; -			sIBOActive = FALSE; +			sIBOActive = false;  		}  		if (mGLBuffer) @@ -2119,13 +2182,13 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  			{  				glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);  				sBindCount++; -				sVBOActive = FALSE; -				setup = TRUE; // ... or a VBO is deactivated +				sVBOActive = false; +				setup = true; // ... or a VBO is deactivated  			}  			if (sGLRenderBuffer != mGLBuffer)  			{  				sGLRenderBuffer = mGLBuffer; -				setup = TRUE; // ... or a client memory pointer changed +				setup = true; // ... or a client memory pointer changed  			}  		}  		if (mGLIndices) @@ -2134,7 +2197,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  			{  				glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);  				sBindCount++; -				sIBOActive = FALSE; +				sIBOActive = false;  			}  			sGLRenderIndices = mGLIndices; @@ -2222,19 +2285,19 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)  		{  			S32 loc = TYPE_WEIGHT;  			void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); -			glVertexAttribPointerARB(loc, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); +			glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);  		}  		if (data_mask & MAP_WEIGHT4)  		{  			S32 loc = TYPE_WEIGHT4;  			void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]); -			glVertexAttribPointerARB(loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); +			glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);  		}  		if (data_mask & MAP_CLOTHWEIGHT)  		{  			S32 loc = TYPE_CLOTHWEIGHT;  			void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); -			glVertexAttribPointerARB(loc, 4, GL_FLOAT, TRUE,  LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); +			glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE,  LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);  		}  		if (data_mask & MAP_TEXTURE_INDEX)  		{ diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index e1cbfd3b61..036f535d81 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -55,9 +55,14 @@ class LLVBOPool  {  public:  	static U32 sBytesPooled; +	 +	LLVBOPool(U32 vboUsage, U32 vboType) +		: mUsage(vboUsage) +		, mType(vboType) +	{} -	U32 mUsage; -	U32 mType; +	const U32 mUsage; +	const U32 mType;  	//size MUST be a power of 2  	volatile U8* allocate(U32& name, U32 size); @@ -103,6 +108,7 @@ public:  	};  	LLVertexBuffer(const LLVertexBuffer& rhs) +		: mUsage(rhs.mUsage)  	{  		*this = rhs;  	} @@ -118,9 +124,9 @@ public:  	static LLVBOPool sStreamIBOPool;  	static LLVBOPool sDynamicIBOPool; -	static BOOL	sUseStreamDraw; -	static BOOL sUseVAO; -	static BOOL	sPreferStreamDraw; +	static bool	sUseStreamDraw; +	static bool sUseVAO; +	static bool	sPreferStreamDraw;  	static void initClass(bool use_vbo, bool no_vbo_mapping);  	static void cleanupClass(); @@ -201,7 +207,7 @@ protected:  	void 	destroyGLIndices();  	void	updateNumVerts(S32 nverts);  	void	updateNumIndices(S32 nindices);  -	virtual BOOL	useVBOs() const; +	bool	useVBOs() const;  	void	unmapBuffer();  public: @@ -239,8 +245,8 @@ public:  	bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false); -	BOOL isEmpty() const					{ return mEmpty; } -	BOOL isLocked() const					{ return mVertexLocked || mIndexLocked; } +	bool isEmpty() const					{ return mEmpty; } +	bool isLocked() const					{ return mVertexLocked || mIndexLocked; }  	S32 getNumVerts() const					{ return mNumVerts; }  	S32 getNumIndices() const				{ return mNumIndices; } @@ -254,7 +260,11 @@ public:  	volatile U8* getMappedIndices() const			{ return mMappedIndexData; }  	S32 getOffset(S32 type) const			{ return mOffsets[type]; }  	S32 getUsage() const					{ return mUsage; } +<<<<<<< local +	bool isWriteable() const				{ return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? true : false; } +=======  	BOOL isWriteable() const				{ return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? TRUE : FALSE; } +>>>>>>> other  	void draw(U32 mode, U32 count, U32 indices_offset) const;  	void drawArrays(U32 mode, U32 offset, U32 count) const; @@ -274,18 +284,32 @@ protected:  	S32		mSize;  	S32		mIndicesSize;  	U32		mTypeMask; -	S32		mUsage;			// GL usage + +	const S32		mUsage;			// GL usage +	  	U32		mGLBuffer;		// GL VBO handle  	U32		mGLIndices;		// GL IBO handle  	U32		mGLArray;		// GL VAO handle  	volatile U8* mMappedData;	// pointer to currently mapped data (NULL if unmapped)  	volatile U8* mMappedIndexData;	// pointer to currently mapped indices (NULL if unmapped) +<<<<<<< local + +	U32		mMappedDataUsingVBOs : 1; +	U32		mMappedIndexDataUsingVBOs : 1; +	U32		mVertexLocked : 1;			// if true, vertex buffer is being or has been written to in client memory +	U32		mIndexLocked : 1;			// if true, index buffer is being or has been written to in client memory +	U32		mFinal : 1;			// if true, buffer can not be mapped again +	U32		mEmpty : 1;			// if true, client buffer is empty (or NULL). Old values have been discarded.	 +	 +	mutable bool	mMappable;     // if true, use memory mapping to upload data (otherwise doublebuffer and use glBufferSubData) +=======  	BOOL	mVertexLocked;			// if TRUE, vertex buffer is being or has been written to in client memory  	BOOL	mIndexLocked;			// if TRUE, index buffer is being or has been written to in client memory  	BOOL	mFinal;			// if TRUE, buffer can not be mapped again  	BOOL	mEmpty;			// if TRUE, client buffer is empty (or NULL). Old values have been discarded.	  	mutable BOOL	mMappable;     // if TRUE, use memory mapping to upload data (otherwise doublebuffer and use glBufferSubData) +>>>>>>> other  	S32		mOffsets[TYPE_MAX];  	std::vector<MappedRegion> mMappedVertexRegions; @@ -296,6 +320,7 @@ protected:  	void placeFence() const;  	void waitFence() const; +	static S32 determineUsage(S32 usage);  private:  	static LLPrivateMemoryPool* sPrivatePoolp ; @@ -304,18 +329,18 @@ public:  	static S32 sCount;  	static S32 sGLCount;  	static S32 sMappedCount; -	static BOOL sMapped; +	static bool sMapped;  	typedef std::list<LLVertexBuffer*> buffer_list_t; -	static BOOL sDisableVBOMapping; //disable glMapBufferARB -	static BOOL sEnableVBOs; +	static bool sDisableVBOMapping; //disable glMapBufferARB +	static bool sEnableVBOs;  	static S32 sTypeSize[TYPE_MAX];  	static U32 sGLMode[LLRender::NUM_MODES];  	static U32 sGLRenderBuffer;  	static U32 sGLRenderArray;  	static U32 sGLRenderIndices; -	static BOOL sVBOActive; -	static BOOL sIBOActive; +	static bool sVBOActive; +	static bool sIBOActive;  	static U32 sLastMask;  	static U32 sAllocatedBytes;  	static U32 sBindCount; | 
