RHI: introduce a way to disable framebuffer clears on GL
On low-end hardware without fast framebuffer clears one can significantly reduce the fill rate by disabling framebuffer clears (provided, as it's usually the case, that the application has content filling the entire framebuffer). Add a couple of environment variables to do so, one to disable all clears and one to disable only color clears (in case the surface is requested without a depth buffer). Note that disabling all clears on a surface *with* a depth buffer still requires QSG_NO_DEPTH_BUFFER to be set, otherwise QtQuick is going to assume that there is a clean usable depth buffer. Change-Id: I96ad0a3d28dd0ab65cc960fb7cb2e0a8b6f35628 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
5ed0974ef4
commit
95fd21a26a
@ -3621,13 +3621,16 @@ QGles2RenderTargetData *QRhiGles2::enqueueBindFramebuffer(QRhiRenderTarget *rt,
|
|||||||
QGles2CommandBuffer::Command &fbCmd(cbD->commands.get());
|
QGles2CommandBuffer::Command &fbCmd(cbD->commands.get());
|
||||||
fbCmd.cmd = QGles2CommandBuffer::Command::BindFramebuffer;
|
fbCmd.cmd = QGles2CommandBuffer::Command::BindFramebuffer;
|
||||||
|
|
||||||
|
static const bool doClearBuffers = qEnvironmentVariableIntValue("QT_GL_NO_CLEAR_BUFFERS") == 0;
|
||||||
|
static const bool doClearColorBuffer = qEnvironmentVariableIntValue("QT_GL_NO_CLEAR_COLOR_BUFFER") == 0;
|
||||||
|
|
||||||
switch (rt->resourceType()) {
|
switch (rt->resourceType()) {
|
||||||
case QRhiResource::RenderTarget:
|
case QRhiResource::RenderTarget:
|
||||||
rtD = &QRHI_RES(QGles2ReferenceRenderTarget, rt)->d;
|
rtD = &QRHI_RES(QGles2ReferenceRenderTarget, rt)->d;
|
||||||
if (wantsColorClear)
|
if (wantsColorClear)
|
||||||
*wantsColorClear = true;
|
*wantsColorClear = doClearBuffers && doClearColorBuffer;
|
||||||
if (wantsDsClear)
|
if (wantsDsClear)
|
||||||
*wantsDsClear = true;
|
*wantsDsClear = doClearBuffers;
|
||||||
fbCmd.args.bindFramebuffer.fbo = 0;
|
fbCmd.args.bindFramebuffer.fbo = 0;
|
||||||
fbCmd.args.bindFramebuffer.colorAttCount = 1;
|
fbCmd.args.bindFramebuffer.colorAttCount = 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user