QVulkanWindow: Add missing device wait after user code
In a multi-threaded setup it is not unlikely that releaseSwapChainResources() will wait for and submit any remaining frame building. Hence a wait is necessary also after invoking the user's implementation. Change-Id: I3c963c05c1c3981980da5e4ff9c572df24a1e473 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
9a9195c806
commit
92dce210a2
@ -925,8 +925,10 @@ void QVulkanWindowPrivate::reset()
|
|||||||
|
|
||||||
devFuncs->vkDeviceWaitIdle(dev);
|
devFuncs->vkDeviceWaitIdle(dev);
|
||||||
|
|
||||||
if (renderer)
|
if (renderer) {
|
||||||
renderer->releaseResources();
|
renderer->releaseResources();
|
||||||
|
devFuncs->vkDeviceWaitIdle(dev);
|
||||||
|
}
|
||||||
|
|
||||||
if (defaultRenderPass) {
|
if (defaultRenderPass) {
|
||||||
devFuncs->vkDestroyRenderPass(dev, defaultRenderPass, nullptr);
|
devFuncs->vkDestroyRenderPass(dev, defaultRenderPass, nullptr);
|
||||||
@ -1436,8 +1438,10 @@ void QVulkanWindowPrivate::releaseSwapChain()
|
|||||||
|
|
||||||
devFuncs->vkDeviceWaitIdle(dev);
|
devFuncs->vkDeviceWaitIdle(dev);
|
||||||
|
|
||||||
if (renderer)
|
if (renderer) {
|
||||||
renderer->releaseSwapChainResources();
|
renderer->releaseSwapChainResources();
|
||||||
|
devFuncs->vkDeviceWaitIdle(dev);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < frameLag; ++i) {
|
for (int i = 0; i < frameLag; ++i) {
|
||||||
FrameResources &frame(frameRes[i]);
|
FrameResources &frame(frameRes[i]);
|
||||||
@ -1676,8 +1680,8 @@ void QVulkanWindowRenderer::initResources()
|
|||||||
have multiple calls to initSwapChainResources() and
|
have multiple calls to initSwapChainResources() and
|
||||||
releaseSwapChainResources() calls in-between.
|
releaseSwapChainResources() calls in-between.
|
||||||
|
|
||||||
Accessors like swapChainImageSize() are only guaranteed to return valid
|
Accessors like QVulkanWindow::swapChainImageSize() are only guaranteed to
|
||||||
values inside this function and afterwards, up until
|
return valid values inside this function and afterwards, up until
|
||||||
releaseSwapChainResources() is called.
|
releaseSwapChainResources() is called.
|
||||||
|
|
||||||
This is also the place where size-dependent calculations (for example, the
|
This is also the place where size-dependent calculations (for example, the
|
||||||
@ -1698,9 +1702,16 @@ void QVulkanWindowRenderer::initSwapChainResources()
|
|||||||
followed by a new call to initSwapChainResources() at a later point.
|
followed by a new call to initSwapChainResources() at a later point.
|
||||||
|
|
||||||
QVulkanWindow takes care of waiting for the device to become idle before
|
QVulkanWindow takes care of waiting for the device to become idle before
|
||||||
invoking this function.
|
and after invoking this function.
|
||||||
|
|
||||||
The default implementation is empty.
|
The default implementation is empty.
|
||||||
|
|
||||||
|
\note This is the last place to act with all graphics resources intact
|
||||||
|
before QVulkanWindow starts releasing them. It is therefore essential that
|
||||||
|
implementations with an asynchronous, potentially multi-threaded
|
||||||
|
startNextFrame() perform a blocking wait and call
|
||||||
|
QVulkanWindow::frameReady() before returning from this function in case
|
||||||
|
there is a pending frame submission.
|
||||||
*/
|
*/
|
||||||
void QVulkanWindowRenderer::releaseSwapChainResources()
|
void QVulkanWindowRenderer::releaseSwapChainResources()
|
||||||
{
|
{
|
||||||
@ -1714,7 +1725,7 @@ void QVulkanWindowRenderer::releaseSwapChainResources()
|
|||||||
followed by an initResources() at a later point.
|
followed by an initResources() at a later point.
|
||||||
|
|
||||||
QVulkanWindow takes care of waiting for the device to become idle before
|
QVulkanWindow takes care of waiting for the device to become idle before
|
||||||
invoking this function.
|
and after invoking this function.
|
||||||
|
|
||||||
The default implementation is empty.
|
The default implementation is empty.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user