mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-28 06:32:29 +00:00
Clear and InvalidateFramebuffer optimization
This commit is contained in:
parent
fa2bcebd51
commit
5eeac830eb
3 changed files with 12 additions and 8 deletions
|
@ -174,19 +174,19 @@ void FGLRenderer::Set3DViewport(bool mainview)
|
||||||
mBuffers->BindSceneFB();
|
mBuffers->BindSceneFB();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always clear all buffers with scissor test disabled.
|
||||||
|
// This is faster on newer hardware because it allows the GPU to skip
|
||||||
|
// reading from slower memory where the full buffers are stored.
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
const auto &bounds = mSceneViewport;
|
const auto &bounds = mSceneViewport;
|
||||||
glViewport(bounds.left, bounds.top, bounds.width, bounds.height);
|
glViewport(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||||
glScissor(bounds.left, bounds.top, bounds.width, bounds.height);
|
glScissor(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
|
||||||
#else
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
|
|
|
@ -244,6 +244,8 @@ void gl_LoadExtensions()
|
||||||
gl.buffermethod = BM_PERSISTENT;
|
gl.buffermethod = BM_PERSISTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gl.version >= 4.3f || CheckExtension("GL_ARB_invalidate_subdata")) gl.flags |= RFL_INVALIDATE_BUFFER;
|
||||||
|
|
||||||
const char *lm = Args->CheckValue("-lightmethod");
|
const char *lm = Args->CheckValue("-lightmethod");
|
||||||
if (lm != NULL)
|
if (lm != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,9 @@ enum RenderFlags
|
||||||
|
|
||||||
RFL_NO_RGBA16F = 32,
|
RFL_NO_RGBA16F = 32,
|
||||||
RFL_NO_DEPTHSTENCIL = 64,
|
RFL_NO_DEPTHSTENCIL = 64,
|
||||||
RFL_NO_CLIP_PLANES = 128
|
RFL_NO_CLIP_PLANES = 128,
|
||||||
|
|
||||||
|
RFL_INVALIDATE_BUFFER = 256
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TexMode
|
enum TexMode
|
||||||
|
|
Loading…
Reference in a new issue