diff options
| author | Dave Parks <davep@lindenlab.com> | 2012-01-19 14:57:07 -0600 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2012-01-19 14:57:07 -0600 | 
| commit | 655505d304fb527df61ee8222904940ad6c70db8 (patch) | |
| tree | 3ecaf9b6d2f6f2bc9936aab3e36cd06cfb3bbef4 | |
| parent | f7cee997df9d7ca40aa40f56c87ff3968821d13a (diff) | |
SH-2794 Fix for bad textures on some hardware when vbo mapping disabled (always use GL_STREAM_DRAW as the usage hint when mapping is disabled as geometry will be uploaded again and again)
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 19 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.h | 2 | 
2 files changed, 17 insertions, 4 deletions
| diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 62be5c7368..eb302392bb 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -166,13 +166,18 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size)  		//make a new buffer  		glGenBuffersARB(1, &name);  		glBindBufferARB(mType, name); -		glBufferDataARB(mType, size, 0, mUsage);  		LLVertexBuffer::sAllocatedBytes += size;  		if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)  		{ +			glBufferDataARB(mType, size, 0, mUsage);  			ret = (U8*) ll_aligned_malloc_16(size);  		} +		else +		{ //always use a true hint of static draw when allocating non-client-backed buffers +			glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB); +		} +  		glBindBufferARB(mType, 0);  	}  	else @@ -794,9 +799,17 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :  	if (mUsage && mUsage != GL_STREAM_DRAW_ARB)  	{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default -		mUsage = GL_DYNAMIC_DRAW_ARB; +		if (sDisableVBOMapping) +		{ //always use stream draw if VBO mapping is disabled +			mUsage = GL_STREAM_DRAW_ARB; +		} +		else +		{ +			mUsage = GL_DYNAMIC_DRAW_ARB; +		}  	} -		 +	 +  	if (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping)  	{  		mMappable = TRUE; diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index dde2b7e152..e1cbfd3b61 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -254,7 +254,7 @@ public:  	volatile U8* getMappedIndices() const			{ return mMappedIndexData; }  	S32 getOffset(S32 type) const			{ return mOffsets[type]; }  	S32 getUsage() const					{ return mUsage; } -	BOOL isWriteable() const				{ return (sDisableVBOMapping || mMappable || mUsage == GL_STREAM_DRAW_ARB) ? TRUE : FALSE; } +	BOOL isWriteable() const				{ return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? TRUE : FALSE; }  	void draw(U32 mode, U32 count, U32 indices_offset) const;  	void drawArrays(U32 mode, U32 offset, U32 count) const; | 
