From 274da636a00fd0469f7857dad7995cb11552e4ab Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 23 Jan 2023 11:48:43 -0600 Subject: SL-18869 Followup -- AMD optimization pass. --- indra/llrender/llvertexbuffer.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'indra/llrender/llvertexbuffer.cpp') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 028db79566..40ab4a2e0f 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -262,27 +262,29 @@ static GLuint gen_buffer() LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; GLuint ret = 0; - if (!gGLManager.mIsAMD) - { - constexpr U32 pool_size = 4096; + constexpr U32 pool_size = 4096; - thread_local static GLuint sNamePool[pool_size]; - thread_local static U32 sIndex = 0; + thread_local static GLuint sNamePool[pool_size]; + thread_local static U32 sIndex = 0; - if (sIndex == 0) + if (sIndex == 0) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer"); + sIndex = pool_size; + if (!gGLManager.mIsAMD) { - LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer"); - sIndex = pool_size; glGenBuffers(pool_size, sNamePool); } - - ret = sNamePool[--sIndex]; - } - else - { - glGenBuffers(1, &ret); + else + { // work around for AMD driver bug + for (U32 i = 0; i < pool_size; ++i) + { + glGenBuffers(1, sNamePool + i); + } + } } + ret = sNamePool[--sIndex]; return ret; } -- cgit v1.2.3