diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2026-10-13 14:30:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-13 14:30:21 -0400 |
| commit | 8ba5d1a8adc47c21b23d9482e72de9517f9a98fc (patch) | |
| tree | f97d67c8ee574c6ebaac8d0d8ba120d041dca051 /indra/llrender/llvertexbuffer.cpp | |
| parent | 18648fc51e2a0c750182d8aa3814ed5b6bf8445e (diff) | |
| parent | efc7d2d7bb542ac905cb7ebd82ee329523f95608 (diff) | |
Merge pull request #6193 from secondlife/release/26.4
Release/26.4
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index d59ddd0fec..2d64292fe7 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -296,18 +296,21 @@ static void delete_buffers(S32 count, GLuint* buffers) LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; // wait a few frames before actually deleting the buffers to avoid // synchronization issues with the GPU - static std::vector<GLuint> sFreeList[4]; + constexpr U32 BUCKET_COUNT = 4; + static std::vector<GLuint> sFreeList[BUCKET_COUNT]; if (gGLManager.mInited) { - U32 idx = LLImageGL::sFrameCount % 4; + // Move current frame to free list + U32 idx = LLImageGL::sFrameCount % BUCKET_COUNT; for (S32 i = 0; i < count; ++i) { sFreeList[idx].push_back(buffers[i]); } - idx = (LLImageGL::sFrameCount + 3) % 4; + // Clear frame -3 (equals +1), this idx will be written over on the next call + idx = (LLImageGL::sFrameCount + 1) % BUCKET_COUNT; if (!sFreeList[idx].empty()) { @@ -939,12 +942,14 @@ void LLVertexBuffer::initClass(LLWindow* window) { llassert(sVBOPool == nullptr); +#if LL_DARWIN || LL_ARM64 if (gGLManager.mIsApple) { LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL; sVBOPool = new LLAppleVBOPool(); } else +#endif { LL_INFOS() << "VBO Pooling Enabled" << LL_ENDL; sVBOPool = new LLDefaultVBOPool(); @@ -1282,7 +1287,12 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde count = mNumVerts - index; } +#if LL_DARWIN || LL_ARM64 + // Region tracking not needed on apple silicon - it recreates entire buffer + // While mIsApple can be encountered under windows, this is a + // macOS OpenGL behavior workaround. LL_ARM64 check might be not needed if (!gGLManager.mIsApple) +#endif { U32 start = mOffsets[type] + sTypeSize[type] * index; U32 end = start + sTypeSize[type] * count-1; @@ -1319,7 +1329,9 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) count = mNumIndices-index; } +#if LL_DARWIN || LL_ARM64 if (!gGLManager.mIsApple) +#endif { U32 start = sizeof(U16) * index; U32 end = start + sizeof(U16) * count-1; @@ -1354,6 +1366,7 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count) // dst -- mMappedData or mMappedIndexData void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8* dst) { +#if LL_DARWIN || LL_ARM64 if (gGLManager.mIsApple) { // on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call @@ -1365,6 +1378,7 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8 memcpy(dst+start, data, end-start+1); } else +#endif { llassert(target == GL_ARRAY_BUFFER ? sGLRenderBuffer == mGLBuffer : sGLRenderIndices == mGLIndices); @@ -1420,6 +1434,7 @@ void LLVertexBuffer::_unmapBuffer() } }; +#if LL_DARWIN || LL_ARM64 if (gGLManager.mIsApple) { STOP_GLERROR; @@ -1462,6 +1477,7 @@ void LLVertexBuffer::_unmapBuffer() STOP_GLERROR; } else +#endif // LL_DARWIN || LL_ARM64 { if (!mMappedVertexRegions.empty()) { |
