From 68da705f3ba284928c7e23acd4164d56dea17af9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 10 Jan 2023 18:42:09 -0600 Subject: SL-18869 Optimizations -- Quiet command buffer -- VBO cache for UI et al and remove many unneeded VBO binds. --- indra/llrender/llvertexbuffer.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'indra/llrender/llvertexbuffer.cpp') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 20261dcb8a..57be21cf6e 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1180,7 +1180,6 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 start, S32 end) U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; - bindGLBuffer(true); if (mFinal) { LL_ERRS() << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << LL_ENDL; @@ -1256,7 +1255,6 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; - bindGLIndices(true); if (mFinal) { LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << LL_ENDL; @@ -2070,6 +2068,24 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } - } +} + +void LLVertexBuffer::setPositionData(const LLVector4a* data) +{ + bindGLBuffer(); + flush_vbo(GL_ARRAY_BUFFER, 0, sizeof(LLVector4a) * getNumVerts(), (U8*) data); +} + +void LLVertexBuffer::setTexCoordData(const LLVector2* data) +{ + bindGLBuffer(); + flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_TEXCOORD0], mOffsets[TYPE_TEXCOORD0] + sTypeSize[TYPE_TEXCOORD0] * getNumVerts(), (U8*)data); +} + +void LLVertexBuffer::setColorData(const LLColor4U* data) +{ + bindGLBuffer(); + flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_COLOR], mOffsets[TYPE_COLOR] + sTypeSize[TYPE_COLOR] * getNumVerts(), (U8*) data); +} -- cgit v1.2.3