Skip to content
Snippets Groups Projects
Commit 8799d40e authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix GL Core

parent eabed00d
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -535,6 +535,7 @@ U32 LLVertexBuffer::sGLRenderBuffer = 0;
U32 LLVertexBuffer::sGLRenderIndices = 0;
U32 LLVertexBuffer::sLastMask = 0;
U32 LLVertexBuffer::sVertexCount = 0;
GLuint LLVertexBuffer::sDummyVAO = 0;
//NOTE: each component must be AT LEAST 4 bytes in size to avoid a performance penalty on AMD hardware
......@@ -760,6 +761,24 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
//static
void LLVertexBuffer::initClass(LLWindow* window)
{
#ifdef GL_ARB_vertex_array_object
if (LLRender::sGLCoreProfile)
{
if (sDummyVAO != 0)
{
glBindVertexArray(0);
glDeleteVertexArrays(1, &sDummyVAO);
sDummyVAO = 0;
}
{ //bind a dummy vertex array object so we're core profile compliant
glGenVertexArrays(1, &sDummyVAO);
glBindVertexArray(sDummyVAO);
}
stop_glerror();
}
#endif
llassert(sVBOPool == nullptr);
sVBOPool = new LLVBOPool();
......@@ -792,6 +811,15 @@ void LLVertexBuffer::cleanupClass()
delete sVBOPool;
sVBOPool = nullptr;
if (sDummyVAO != 0)
{
#ifdef GL_ARB_vertex_array_object
glBindVertexArray(0);
glDeleteVertexArrays(1, &sDummyVAO);
#endif
sDummyVAO = 0;
}
#if ENABLE_GL_WORK_QUEUE
sQueue->close();
for (int i = 0; i < THREAD_COUNT; ++i)
......
......@@ -259,6 +259,7 @@ class LLVertexBuffer final : public LLRefCount
static U32 sGLRenderIndices;
static U32 sLastMask;
static U32 sVertexCount;
static GLuint sDummyVAO;
};
#ifdef LL_PROFILER_ENABLE_RENDER_DOC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment