rhi: gl: Unify end/finish behavior
Issue a glFlush in endOffscreenFrame. This matches endFrame which flushes either implicitly (swapBuffers) or explicitly with SkipPresent (glFlush). This will then benefit producer-consumer setups where a context renders into a texture using begin/endOffscreenFrame and then the texture is consumed in another context. In addition, make finish() issue a glFinish(). Change-Id: I0a3115255ad2ac82b730e26d1ca7e88377c5a28c Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit cb139dbdb8d7ff1f9e9be24623697035677c9774) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9d5b0a77da
commit
f95a5ec4ce
@ -1942,6 +1942,12 @@ QRhi::FrameOpResult QRhiGles2::endOffscreenFrame(QRhi::EndFrameFlags flags)
|
|||||||
|
|
||||||
executeCommandBuffer(&ofr.cbWrapper);
|
executeCommandBuffer(&ofr.cbWrapper);
|
||||||
|
|
||||||
|
// Just as endFrame() does a flush when skipping the swapBuffers(), do it
|
||||||
|
// here as well. This has the added benefit of playing nice when rendering
|
||||||
|
// to a texture from a context and then consuming that texture from
|
||||||
|
// another, sharing context.
|
||||||
|
f->glFlush();
|
||||||
|
|
||||||
return QRhi::FrameOpSuccess;
|
return QRhi::FrameOpSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1963,6 +1969,12 @@ QRhi::FrameOpResult QRhiGles2::finish()
|
|||||||
executeCommandBuffer(¤tSwapChain->cb);
|
executeCommandBuffer(¤tSwapChain->cb);
|
||||||
currentSwapChain->cb.resetCommands();
|
currentSwapChain->cb.resetCommands();
|
||||||
}
|
}
|
||||||
|
// Do an actual glFinish(). May seem superfluous, but this is what
|
||||||
|
// matches most other backends e.g. Vulkan/Metal that do a heavyweight
|
||||||
|
// wait-for-idle blocking in their finish(). More importantly, this
|
||||||
|
// allows clients simply call finish() in threaded or shared context
|
||||||
|
// situations where one explicitly needs to do a glFlush or Finish.
|
||||||
|
f->glFinish();
|
||||||
}
|
}
|
||||||
return QRhi::FrameOpSuccess;
|
return QRhi::FrameOpSuccess;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user