summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rw-r--r--indra/llrender/llvertexbuffer.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index f1d71ec94d..028db79566 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -260,19 +260,30 @@ static GLWorkQueue* sQueue = nullptr;
static GLuint gen_buffer()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
- constexpr U32 pool_size = 4096;
- thread_local static GLuint sNamePool[pool_size];
- thread_local static U32 sIndex = 0;
+ GLuint ret = 0;
+ if (!gGLManager.mIsAMD)
+ {
+ constexpr U32 pool_size = 4096;
+
+ thread_local static GLuint sNamePool[pool_size];
+ thread_local static U32 sIndex = 0;
+
+ if (sIndex == 0)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
+ sIndex = pool_size;
+ glGenBuffers(pool_size, sNamePool);
+ }
- if (sIndex == 0)
+ ret = sNamePool[--sIndex];
+ }
+ else
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
- sIndex = pool_size;
- glGenBuffers(pool_size, sNamePool);
+ glGenBuffers(1, &ret);
}
- return sNamePool[--sIndex];
+ return ret;
}
#define ANALYZE_VBO_POOL 0
@@ -725,7 +736,6 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
llassert(mGLBuffer == sGLRenderBuffer);
llassert(mGLIndices == sGLRenderIndices);
gGL.syncMatrices();
-
glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT,
(GLvoid*) (indices_offset * sizeof(U16)));
}
@@ -1144,7 +1154,8 @@ static void flush_vbo(GLenum target, U32 start, U32 end, void* data)
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("glBufferSubData block");
//LL_PROFILE_GPU_ZONE("glBufferSubData");
U32 tend = llmin(i + block_size, end);
- glBufferSubData(target, i, tend - i+1, (U8*) data + (i-start));
+ U32 size = tend - i + 1;
+ glBufferSubData(target, i, size, (U8*) data + (i-start));
}
}
}