diff options
| -rw-r--r-- | autobuild.xml | 110 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 276 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.h | 33 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llviewercontrol.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 20 | ||||
| -rw-r--r-- | indra/newview/pipeline.h | 1 | 
8 files changed, 323 insertions, 140 deletions
diff --git a/autobuild.xml b/autobuild.xml index 81eb6943d2..93f9ac5bf6 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1368,9 +1368,9 @@              <key>archive</key>              <map>                <key>hash</key> -              <string>d47d121c8eaed4ac6d8253ceda23b5c9</string> +              <string>320820c5a886f8daf366ba5fcd264b34</string>                <key>url</key> -              <string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/pth-2.0.7-darwin-20101004.tar.bz2</string> +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-pth/rev/222035/arch/Darwin/installer/pth-2.0.7-darwin-20110224.tar.bz2</string>              </map>              <key>name</key>              <string>darwin</string> @@ -1646,29 +1646,6 @@                <key>name</key>                <string>OpenSourceRelWithDebInfo</string>              </map> -            <!-- OPEN-1 WORKAROUND begin - to be removed when VC express is detected correctly --> -            <key>VCexpressRelWithDebInfo</key> -            <map> -              <key>configure</key> -              <map> -                <key>arguments</key> -                <array> -                  <string>../indra</string> -                </array> -                <key>command</key> -                <string>cmake</string> -                <key>options</key> -                <array> -                  <string>-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</string> -                  <string>-DUNATTENDED:BOOL=OFF</string> -                  <string>-DWORD_SIZE:STRING=32</string> -                  <string>-DROOT_PROJECT_NAME:STRING=SecondLife</string> -                </array> -              </map> -              <key>name</key> -              <string>VCexpressRelWithDebInfo</string> -            </map> -            <!-- OPEN-1 WORKAROUND end -->              <key>OpenSourceRelease</key>              <map>                <key>configure</key> @@ -1801,6 +1778,27 @@                <key>name</key>                <string>Release</string>              </map> +            <key>VCexpressRelWithDebInfo</key> +            <map> +              <key>configure</key> +              <map> +                <key>arguments</key> +                <array> +                  <string>../indra</string> +                </array> +                <key>command</key> +                <string>cmake</string> +                <key>options</key> +                <array> +                  <string>-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</string> +                  <string>-DUNATTENDED:BOOL=OFF</string> +                  <string>-DWORD_SIZE:STRING=32</string> +                  <string>-DROOT_PROJECT_NAME:STRING=SecondLife</string> +                </array> +              </map> +              <key>name</key> +              <string>VCexpressRelWithDebInfo</string> +            </map>            </map>            <key>name</key>            <string>common</string> @@ -2413,38 +2411,6 @@                <key>name</key>                <string>OpenSourceRelWithDebInfo</string>              </map> -            <!-- OPEN-1 WORKAROUND begin - to be removed when VC express is detected correctly --> -            <key>VCexpressRelWithDebInfo</key> -            <map> -              <key>build</key> -              <map> -                <key>arguments</key> -                <array> -                  <string>"RelWithDebInfo|Win32"</string> -                </array> -                <key>command</key> -                <string>vcbuild.exe</string> -                <key>options</key> -                <array> -                  <string>/u</string> -                  <string>SecondLife.sln</string> -                </array> -              </map> -              <key>configure</key> -              <map> -                <key>options</key> -                <array> -                  <string>-G</string> -                  <string>"Visual Studio 8 2005"</string> -                  <string>-DSTANDALONE:BOOL=FALSE</string> -                  <string>-DINSTALL_PROPRIETARY=FALSE</string> -                  <string>-DFMOD=FALSE</string> -                </array> -              </map> -              <key>name</key> -              <string>VCexpressRelWithDebInfo</string> -            </map> -            <!-- OPEN-1 WORKAROUND end -->              <key>OpenSourceRelease</key>              <map>                <key>build</key> @@ -2627,6 +2593,36 @@                <key>name</key>                <string>Release</string>              </map> +            <key>VCexpressRelWithDebInfo</key> +            <map> +              <key>build</key> +              <map> +                <key>arguments</key> +                <array> +                  <string>"RelWithDebInfo|Win32"</string> +                </array> +                <key>command</key> +                <string>vcbuild.exe</string> +                <key>options</key> +                <array> +                  <string>/u</string> +                  <string>SecondLife.sln</string> +                </array> +              </map> +              <key>configure</key> +              <map> +                <key>options</key> +                <array> +                  <string>-G</string> +                  <string>"Visual Studio 8 2005"</string> +                  <string>-DSTANDALONE:BOOL=FALSE</string> +                  <string>-DINSTALL_PROPRIETARY=FALSE</string> +                  <string>-DFMOD=FALSE</string> +                </array> +              </map> +              <key>name</key> +              <string>VCexpressRelWithDebInfo</string> +            </map>            </map>            <key>name</key>            <string>windows</string> diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 02160b09c4..7b5907a668 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -47,6 +47,7 @@ U32 LLVertexBuffer::sSetCount = 0;  S32 LLVertexBuffer::sCount = 0;  S32 LLVertexBuffer::sGLCount = 0;  S32 LLVertexBuffer::sMappedCount = 0; +BOOL LLVertexBuffer::sDisableVBOMapping = FALSE ;  BOOL LLVertexBuffer::sEnableVBOs = TRUE;  U32 LLVertexBuffer::sGLRenderBuffer = 0;  U32 LLVertexBuffer::sGLRenderIndices = 0; @@ -251,6 +252,7 @@ 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(mRequestedNumIndices >= 0); +  	if (indices_offset >= (U32) mRequestedNumIndices ||  	    indices_offset + count > (U32) mRequestedNumIndices)  	{ @@ -282,6 +284,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const  void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const  {  	llassert(mRequestedNumVerts >= 0); +  	if (first >= (U32) mRequestedNumVerts ||  	    first + count > (U32) mRequestedNumVerts)  	{ @@ -305,9 +308,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const  }  //static -void LLVertexBuffer::initClass(bool use_vbo) +void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)  {  	sEnableVBOs = use_vbo; +	sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ;  	LLGLNamePool::registerPool(&sDynamicVBOPool);  	LLGLNamePool::registerPool(&sDynamicIBOPool);  	LLGLNamePool::registerPool(&sStreamVBOPool); @@ -364,7 +368,9 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :  	mGLBuffer(0),  	mGLIndices(0),   	mMappedData(NULL), -	mMappedIndexData(NULL), mLocked(FALSE), +	mMappedIndexData(NULL),  +	mVertexLocked(FALSE), +	mIndexLocked(FALSE),  	mFinal(FALSE),  	mFilthy(FALSE),  	mEmpty(TRUE), @@ -422,6 +428,8 @@ LLVertexBuffer::~LLVertexBuffer()  	destroyGLBuffer();  	destroyGLIndices();  	sCount--; + +	llassert_always(!mMappedData && !mMappedIndexData) ;  };  //---------------------------------------------------------------------------- @@ -567,6 +575,8 @@ void LLVertexBuffer::destroyGLBuffer()  	{  		if (useVBOs())  		{ +			freeClientBuffer() ; +  			if (mMappedData || mMappedIndexData)  			{  				llerrs << "Vertex buffer destroyed while mapped!" << llendl; @@ -594,11 +604,13 @@ void LLVertexBuffer::destroyGLIndices()  	{  		if (useVBOs())  		{ +			freeClientBuffer() ; +  			if (mMappedData || mMappedIndexData)  			{  				llerrs << "Vertex buffer destroyed while mapped." << llendl;  			} -			releaseIndices(); +			releaseIndices();			  		}  		else  		{ @@ -799,6 +811,7 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)  	if (mResized && useVBOs())  	{ +		freeClientBuffer() ;  		setBuffer(0);  	}  } @@ -822,36 +835,69 @@ BOOL LLVertexBuffer::useVBOs() const  }  //---------------------------------------------------------------------------- +void LLVertexBuffer::freeClientBuffer() +{ +	if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData)) +	{ +		delete[] mMappedData ; +		delete[] mMappedIndexData ; +		mMappedData = NULL ; +		mMappedIndexData = NULL ; +	} +} + +void LLVertexBuffer::allocateClientVertexBuffer() +{ +	if(!mMappedData) +	{ +		U32 size = getSize() ; +		mMappedData = new U8[size]; +		memset(mMappedData, 0, size); +	} +} + +void LLVertexBuffer::allocateClientIndexBuffer() +{ +	if(!mMappedIndexData) +	{ +		U32 size = getIndicesSize(); +		mMappedIndexData = new U8[size]; +		memset(mMappedIndexData, 0, size); +	} +}  // Map for data access -U8* LLVertexBuffer::mapBuffer(S32 access) +U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 access)  {  	LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER);  	if (mFinal)  	{ -		llerrs << "LLVertexBuffer::mapBuffer() called on a finalized buffer." << llendl; +		llerrs << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << llendl;  	}  	if (!useVBOs() && !mMappedData && !mMappedIndexData)  	{ -		llerrs << "LLVertexBuffer::mapBuffer() called on unallocated buffer." << llendl; +		llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl;  	} -	if (!mLocked && useVBOs()) +	if (!mVertexLocked && useVBOs())  	{  		{  			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES); -			setBuffer(0); -			mLocked = TRUE; +			setBuffer(0, type); +			mVertexLocked = TRUE;  			stop_glerror();	 -			mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); -			stop_glerror(); -		} -		{ -			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES); -			mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + +			if(sDisableVBOMapping) +			{ +				allocateClientVertexBuffer() ; +			} +			else +			{ +				mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); +			}  			stop_glerror();  		} - +		  		if (!mMappedData)  		{  			log_glerror(); @@ -862,80 +908,166 @@ U8* LLVertexBuffer::mapBuffer(S32 access)  			llinfos << "Available physical mwmory(KB): " << avail_phy_mem << llendl ;   			llinfos << "Available virtual memory(KB): " << avail_vir_mem << llendl; -			//-------------------- -			//print out more debug info before crash -			llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ; -			GLint size ; -			glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ; -			llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ; -			//-------------------- +			if(!sDisableVBOMapping) +			{ +				//-------------------- +				//print out more debug info before crash +				llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ; +				GLint size ; +				glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size) ; +				llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl ; +				//-------------------- -			GLint buff; -			glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); -			if ((GLuint)buff != mGLBuffer) +				GLint buff; +				glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); +				if ((GLuint)buff != mGLBuffer) +				{ +					llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; +				} + +				 +				llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; +			} +			else  			{ -				llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; +				llerrs << "memory allocation for vertex data failed." << llendl ;  			} +		} +		sMappedCount++; +	} +	 +	return mMappedData; +} -			 -			llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; +U8* LLVertexBuffer::mapIndexBuffer(S32 access) +{ +	LLMemType mt2(LLMemType::MTYPE_VERTEX_MAP_BUFFER); +	if (mFinal) +	{ +		llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl; +	} +	if (!useVBOs() && !mMappedData && !mMappedIndexData) +	{ +		llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl; +	} + +	if (!mIndexLocked && useVBOs()) +	{ +		{ +			LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES); + +			setBuffer(0, TYPE_INDEX); +			mIndexLocked = TRUE; +			stop_glerror();	 + +			if(sDisableVBOMapping) +			{ +				allocateClientIndexBuffer() ; +			} +			else +			{ +				mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); +			} +			stop_glerror();  		}  		if (!mMappedIndexData)  		{  			log_glerror(); -			GLint buff; -			glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); -			if ((GLuint)buff != mGLIndices) +			if(!sDisableVBOMapping)  			{ -				llerrs << "Invalid GL index buffer bound: " << buff << llendl; -			} +				GLint buff; +				glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); +				if ((GLuint)buff != mGLIndices) +				{ +					llerrs << "Invalid GL index buffer bound: " << buff << llendl; +				} -			llerrs << "glMapBuffer returned NULL (no index data)" << llendl; +				llerrs << "glMapBuffer returned NULL (no index data)" << llendl; +			} +			else +			{ +				llerrs << "memory allocation for Index data failed. " << llendl ; +			}  		}  		sMappedCount++;  	} -	 -	return mMappedData; + +	return mMappedIndexData ;  } -void LLVertexBuffer::unmapBuffer() +void LLVertexBuffer::unmapBuffer(S32 type)  {  	LLMemType mt2(LLMemType::MTYPE_VERTEX_UNMAP_BUFFER); -	if (mMappedData || mMappedIndexData) +	if (!useVBOs())  	{ -		if (useVBOs() && mLocked) +		return ; //nothing to unmap +	} + +	bool updated_all = false ; +	if (mMappedData && mVertexLocked && type != TYPE_INDEX) +	{ +		updated_all = (mIndexLocked && type < 0) ; //both vertex and index buffers done updating + +		if(sDisableVBOMapping) +		{ +			stop_glerror(); +			glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), mMappedData); +			stop_glerror(); +		} +		else  		{  			stop_glerror();  			glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);  			stop_glerror(); + +			mMappedData = NULL; +		} + +		mVertexLocked = FALSE ; +		sMappedCount--; +	} + +	if(mMappedIndexData && mIndexLocked && (type < 0 || type == TYPE_INDEX)) +	{ +		if(sDisableVBOMapping) +		{ +			stop_glerror(); +			glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), mMappedIndexData); +			stop_glerror(); +		} +		else +		{ +			stop_glerror();  			glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);  			stop_glerror(); -			/*if (!sMapped) -			{ -				llerrs << "Redundantly unmapped VBO!" << llendl; -			} -			sMapped = FALSE;*/ -			sMappedCount--; - -			if (mUsage == GL_STATIC_DRAW_ARB) -			{ //static draw buffers can only be mapped a single time -				//throw out client data (we won't be using it again) -				mEmpty = TRUE; -				mFinal = TRUE; -			} -			else +			mMappedIndexData = NULL ; +		} + +		mIndexLocked = FALSE ; +		sMappedCount--; +	} + +	if(updated_all) +	{ +		if(mUsage == GL_STATIC_DRAW_ARB) +		{ +			//static draw buffers can only be mapped a single time +			//throw out client data (we won't be using it again) +			mEmpty = TRUE; +			mFinal = TRUE; + +			if(sDisableVBOMapping)  			{ -				mEmpty = FALSE; +				freeClientBuffer() ;  			} - -			mMappedIndexData = NULL; -			mMappedData = NULL; -			 -			mLocked = FALSE; +		} +		else +		{ +			mEmpty = FALSE;  		}  	}  } @@ -949,15 +1081,16 @@ template <class T,S32 type> struct VertexBufferStrider  					strider_t& strider,   					S32 index)  	{ -		if (vbo.mapBuffer() == NULL) -		{ -			llwarns << "mapBuffer failed!" << llendl; -			return FALSE; -		} -  		if (type == LLVertexBuffer::TYPE_INDEX)  		{  			S32 stride = sizeof(T); + +			if (vbo.mapIndexBuffer() == NULL) +			{ +				llwarns << "mapIndexBuffer failed!" << llendl; +				return FALSE; +			} +  			strider = (T*)(vbo.getMappedIndices() + index*stride);  			strider.setStride(0);  			return TRUE; @@ -965,6 +1098,13 @@ template <class T,S32 type> struct VertexBufferStrider  		else if (vbo.hasDataType(type))  		{  			S32 stride = vbo.getStride(); + +			if (vbo.mapVertexBuffer(type) == NULL) +			{ +				llwarns << "mapVertexBuffer failed!" << llendl; +				return FALSE; +			} +  			strider = (T*)(vbo.getMappedData() + vbo.getOffset(type) + index*stride);  			strider.setStride(stride);  			return TRUE; @@ -1045,7 +1185,7 @@ void LLVertexBuffer::setStride(S32 type, S32 new_stride)  //----------------------------------------------------------------------------  // Set for rendering -void LLVertexBuffer::setBuffer(U32 data_mask) +void LLVertexBuffer::setBuffer(U32 data_mask, S32 type)  {  	LLMemType mt2(LLMemType::MTYPE_VERTEX_SET_BUFFER);  	//set up pointers if the data mask is different ... @@ -1186,7 +1326,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)  		{  			ll_fail("LLVertexBuffer::mapBuffer failed");  		} -		unmapBuffer(); +		unmapBuffer(type);  	}  	else  	{		 diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 94fa790957..c51ce7ac4e 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -80,7 +80,7 @@ public:  	static BOOL	sUseStreamDraw; -	static void initClass(bool use_vbo); +	static void initClass(bool use_vbo, bool no_vbo_mapping);  	static void cleanupClass();  	static void setupClientArrays(U32 data_mask);   	static void clientCopy(F64 max_time = 0.005); //copy data from client to GL @@ -139,19 +139,24 @@ protected:  	void	updateNumVerts(S32 nverts);  	void	updateNumIndices(S32 nindices);   	virtual BOOL	useVBOs() const; -	void	unmapBuffer(); -		 +	void	unmapBuffer(S32 type); +	void freeClientBuffer() ; +	void allocateClientVertexBuffer() ; +	void allocateClientIndexBuffer() ; +  public:  	LLVertexBuffer(U32 typemask, S32 usage);  	// map for data access -	U8*		mapBuffer(S32 access = -1); +	U8*		mapVertexBuffer(S32 type = -1, S32 access = -1); +	U8*		mapIndexBuffer(S32 access = -1); +  	// set for rendering -	virtual void	setBuffer(U32 data_mask); 	// calls  setupVertexBuffer() if data_mask is not 0 +	virtual void	setBuffer(U32 data_mask, S32 type = -1); 	// calls  setupVertexBuffer() if data_mask is not 0  	// allocate buffer  	void	allocateBuffer(S32 nverts, S32 nindices, bool create);  	virtual void resizeBuffer(S32 newnverts, S32 newnindices); -		 +			  	// Only call each getVertexPointer, etc, once before calling unmapBuffer()  	// call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer()  	// example: @@ -170,7 +175,7 @@ public:  	bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0);  	BOOL isEmpty() const					{ return mEmpty; } -	BOOL isLocked() const					{ return mLocked; } +	BOOL isLocked() const					{ return mVertexLocked || mIndexLocked; }  	S32 getNumVerts() const					{ return mNumVerts; }  	S32 getNumIndices() const				{ return mNumIndices; }  	S32 getRequestedVerts() const			{ return mRequestedNumVerts; } @@ -209,13 +214,14 @@ protected:  	U32		mGLIndices;		// GL IBO handle  	U8*		mMappedData;	// pointer to currently mapped data (NULL if unmapped)  	U8*		mMappedIndexData;	// pointer to currently mapped indices (NULL if unmapped) -	BOOL	mLocked;			// if TRUE, buffer is being or has been written to in client memory +	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	mFilthy;		// if TRUE, entire buffer must be copied (used to prevent redundant dirty flags) -	BOOL	mEmpty;			// if TRUE, client buffer is empty (or NULL). Old values have been discarded. -	S32		mOffsets[TYPE_MAX]; +	BOOL	mEmpty;			// if TRUE, client buffer is empty (or NULL). Old values have been discarded.	  	BOOL	mResized;		// if TRUE, client buffer has been resized and GL buffer has not  	BOOL	mDynamicSize;	// if TRUE, buffer has been resized at least once (and should be padded) +	S32		mOffsets[TYPE_MAX];  	class DirtyRegion  	{ @@ -240,13 +246,14 @@ public:  	static std::vector<U32> sDeleteList;  	typedef std::list<LLVertexBuffer*> buffer_list_t; +	static BOOL sDisableVBOMapping; //disable glMapBufferARB  	static BOOL sEnableVBOs; +	static BOOL sVBOActive; +	static BOOL sIBOActive;  	static S32 sTypeOffsets[TYPE_MAX];  	static U32 sGLMode[LLRender::NUM_MODES];  	static U32 sGLRenderBuffer; -	static U32 sGLRenderIndices; -	static BOOL sVBOActive; -	static BOOL sIBOActive; +	static U32 sGLRenderIndices;	  	static U32 sLastMask;  	static U32 sAllocatedBytes;  	static U32 sBindCount; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6630d8f400..a010524091 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8451,6 +8451,17 @@        <key>Value</key>        <integer>1</integer>      </map> +    <key>RenderVBOMappingDisable</key> +    <map> +      <key>Comment</key> +      <string>Disable VBO glMapBufferARB</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>    <key>RenderUseStreamVBO</key>    <map>      <key>Comment</key> diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 8c5a52c187..3c53e54203 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -309,6 +309,15 @@ static bool handleRenderUseVBOChanged(const LLSD& newvalue)  	return true;  } +static bool handleRenderUseVBOMappingChanged(const LLSD& newvalue) +{ +	if (gPipeline.isInit()) +	{ +		gPipeline.setDisableVBOMapping(newvalue.asBoolean()); +	} +	return true; +} +  static bool handleWLSkyDetailChanged(const LLSD&)  {  	if (gSky.mVOWLSkyp.notNull()) @@ -589,6 +598,7 @@ void settings_setup_listeners()  	gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));  	gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));  	gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _2)); +	gSavedSettings.getControl("RenderVBOMappingDisable")->getSignal()->connect(boost::bind(&handleRenderUseVBOMappingChanged, _2));  	gSavedSettings.getControl("RenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));  	gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2));  	gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2)); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 274dbe2cc8..0028ced6c8 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1477,7 +1477,7 @@ LLViewerWindow::LLViewerWindow(  	{  		gSavedSettings.setBOOL("RenderVBOEnable", FALSE);  	} -	LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable")); +	LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable"));  	if (LLFeatureManager::getInstance()->isSafe()  		|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion()) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 39bc354250..13e537fae5 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5313,7 +5313,25 @@ void LLPipeline::setUseVBO(BOOL use_vbo)  		}  		resetVertexBuffers(); -		LLVertexBuffer::initClass(use_vbo); +		LLVertexBuffer::initClass(use_vbo, gSavedSettings.getBOOL("RenderVBOMappingDisable")); +	} +} + +void LLPipeline::setDisableVBOMapping(BOOL no_vbo_mapping) +{ +	if (LLVertexBuffer::sEnableVBOs && no_vbo_mapping != LLVertexBuffer::sDisableVBOMapping) +	{ +		if (no_vbo_mapping) +		{ +			llinfos << "Disabling VBO glMapBufferARB." << llendl; +		} +		else +		{  +			llinfos << "Enabling VBO glMapBufferARB." << llendl; +		} +		 +		resetVertexBuffers(); +		LLVertexBuffer::initClass(true, no_vbo_mapping);  	}  } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index cef3d87f36..e99b0d71e3 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -111,6 +111,7 @@ public:  	void resetVertexBuffers(LLDrawable* drawable);  	void setUseVBO(BOOL use_vbo); +	void setDisableVBOMapping(BOOL no_vbo_mapping);  	void generateImpostor(LLVOAvatar* avatar);  	void bindScreenToTexture();  	void renderBloom(BOOL for_snapshot, F32 zoom_factor = 1.f, int subfield = 0);  | 
