diff options
author | Dave Parks <davep@lindenlab.com> | 2023-01-20 18:25:53 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-01-20 18:25:53 -0600 |
commit | 984bdcd9d9622cedd17d3d33ecae6b726860dd94 (patch) | |
tree | fa43d720c46a79c0bb7446a94bfc6cc8f73657ce /indra/llrender | |
parent | c2fef4b58838a617650dd40755518dd22558b42b (diff) |
SL-18869 Followup -- AMD compatibility pass.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llgl.cpp | 41 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 31 |
2 files changed, 51 insertions, 21 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 8bb83d4250..1725990e8f 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -86,9 +86,9 @@ void APIENTRY gl_debug_callback(GLenum source, const GLchar* message, GLvoid* userParam) { - if (severity != GL_DEBUG_SEVERITY_HIGH // && - //severity != GL_DEBUG_SEVERITY_MEDIUM && - //severity != GL_DEBUG_SEVERITY_LOW + if (severity != GL_DEBUG_SEVERITY_HIGH && + severity != GL_DEBUG_SEVERITY_MEDIUM && + severity != GL_DEBUG_SEVERITY_LOW ) { //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints) return; @@ -112,10 +112,28 @@ void APIENTRY gl_debug_callback(GLenum source, glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &vao); GLint vbo = 0; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vbo); + GLint vbo_size = 0; + if (vbo != 0) + { + glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &vbo_size); + } GLint ibo = 0; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &ibo); - - if (severity == GL_DEBUG_SEVERITY_HIGH) + GLint ibo_size = 0; + if (ibo != 0) + { + glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &ibo_size); + } + GLint ubo = 0; + glGetIntegerv(GL_UNIFORM_BUFFER_BINDING, &ubo); + GLint ubo_size = 0; + GLint ubo_immutable = 0; + if (ubo != 0) + { + glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_SIZE, &ubo_size); + glGetBufferParameteriv(GL_UNIFORM_BUFFER, GL_BUFFER_IMMUTABLE_STORAGE, &ubo_immutable); + } + //if (severity == GL_DEBUG_SEVERITY_HIGH) { LL_ERRS() << "Halting on GL Error" << LL_ENDL; } @@ -2393,12 +2411,13 @@ void LLGLState::checkStates(GLboolean writeAlpha) llassert_always(src == GL_SRC_ALPHA); llassert_always(dst == GL_ONE_MINUS_SRC_ALPHA); - GLboolean colorMask[4]; - glGetBooleanv(GL_COLOR_WRITEMASK, colorMask); - llassert_always(colorMask[0]); - llassert_always(colorMask[1]); - llassert_always(colorMask[2]); - llassert_always(colorMask[3] == writeAlpha); + // disable for now until usage is consistent + //GLboolean colorMask[4]; + //glGetBooleanv(GL_COLOR_WRITEMASK, colorMask); + //llassert_always(colorMask[0]); + //llassert_always(colorMask[1]); + //llassert_always(colorMask[2]); + // llassert_always(colorMask[3] == writeAlpha); for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin(); iter != sStateMap.end(); ++iter) 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)); } } } |