summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2012-01-19 14:57:07 -0600
committerDave Parks <davep@lindenlab.com>2012-01-19 14:57:07 -0600
commit655505d304fb527df61ee8222904940ad6c70db8 (patch)
tree3ecaf9b6d2f6f2bc9936aab3e36cd06cfb3bbef4 /indra/llrender/llvertexbuffer.cpp
parentf7cee997df9d7ca40aa40f56c87ff3968821d13a (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)
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rw-r--r--indra/llrender/llvertexbuffer.cpp19
1 files changed, 16 insertions, 3 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;