- enable core profile by default on GL 3.x.
After doing some profiling it was very obvious that this has better performance than client arrays. Persistent buffers are still better, though, especially for handling dynamic lights.
This commit is contained in:
parent
0f0dc2c852
commit
8f535997f8
5 changed files with 14 additions and 66 deletions
|
|
@ -148,6 +148,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
|
|||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBufferStorage(GL_ARRAY_BUFFER, bytesize, NULL, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
map = (FFlatVertex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, bytesize, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
DPrintf(DMSG_NOTIFY, "Using persistent buffer\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -157,13 +158,14 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
|
|||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBufferData(GL_ARRAY_BUFFER, bytesize, NULL, GL_STREAM_DRAW);
|
||||
map = nullptr;
|
||||
DPrintf(DMSG_NOTIFY, "Using deferred buffer\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case BM_CLIENTARRAY:
|
||||
{
|
||||
// The fallback path uses immediate mode rendering and does not set up an actual vertex buffer
|
||||
map = new FFlatVertex[BUFFER_SIZE];
|
||||
DPrintf(DMSG_NOTIFY, "Using client array buffer\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
m2DDrawer = new F2DDrawer;
|
||||
|
||||
// Only needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
||||
if (gl.version >= 4.0)
|
||||
if (gl.buffermethod != BM_CLIENTARRAY)
|
||||
{
|
||||
glGenVertexArrays(1, &mVAOID);
|
||||
glBindVertexArray(mVAOID);
|
||||
|
|
|
|||
|
|
@ -156,14 +156,6 @@ void gl_LoadExtensions()
|
|||
|
||||
gl.version = strtod(version, NULL) + 0.01f;
|
||||
|
||||
bool iscore = false;
|
||||
if (gl.version >= 3.2)
|
||||
{
|
||||
int v;
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &v);
|
||||
iscore = !!(v & GL_CONTEXT_CORE_PROFILE_BIT);
|
||||
}
|
||||
|
||||
// Don't even start if it's lower than 2.0 or no framebuffers are available
|
||||
if ((gl.version < 2.0 || !CheckExtension("GL_EXT_framebuffer_object")) && gl.version < 3.0)
|
||||
{
|
||||
|
|
@ -186,10 +178,7 @@ void gl_LoadExtensions()
|
|||
if (gl.version > 3.0f && (gl.version >= 3.3f || CheckExtension("GL_ARB_uniform_buffer_object")))
|
||||
{
|
||||
gl.lightmethod = LM_DEFERRED;
|
||||
if (iscore)
|
||||
{
|
||||
gl.buffermethod = BM_DEFERRED;
|
||||
}
|
||||
gl.buffermethod = BM_DEFERRED;
|
||||
}
|
||||
|
||||
if (CheckExtension("GL_ARB_texture_compression")) gl.flags |= RFL_TEXTURE_COMPRESSION;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue