Commit be394bad by Geoff Lang Committed by Commit Bot

Vulkan: Reset swap chain image dependency information when aquiring.

If an image was used by a different context previously, it's stored serial is not relevent. We always know that any work involving the swap chain image has been completed by the time we aquire a new one. BUG=angleproject:2464 Change-Id: I0b12b9ff4b9a68593d661344d2d1e2c9d94e4755 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1592043Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent e25ff9d8
...@@ -182,6 +182,13 @@ bool CommandGraphResource::isResourceInUse(RendererVk *renderer) const ...@@ -182,6 +182,13 @@ bool CommandGraphResource::isResourceInUse(RendererVk *renderer) const
return renderer->isSerialInUse(mStoredQueueSerial); return renderer->isSerialInUse(mStoredQueueSerial);
} }
void CommandGraphResource::resetQueueSerial()
{
mCurrentWritingNode = nullptr;
mCurrentReadingNodes.clear();
mStoredQueueSerial = Serial();
}
angle::Result CommandGraphResource::recordCommands(Context *context, angle::Result CommandGraphResource::recordCommands(Context *context,
CommandBuffer **commandBufferOut) CommandBuffer **commandBufferOut)
{ {
......
...@@ -277,6 +277,10 @@ class CommandGraphResource : angle::NonCopyable ...@@ -277,6 +277,10 @@ class CommandGraphResource : angle::NonCopyable
} }
} }
// Reset the current queue serial for this resource. Will clear dependencies if the resource
// was not used in this set of command nodes.
void resetQueueSerial();
// Allocates a write node via getNewWriteNode and returns a started command buffer. // Allocates a write node via getNewWriteNode and returns a started command buffer.
// The started command buffer will render outside of a RenderPass. // The started command buffer will render outside of a RenderPass.
// Will append to an existing command buffer/graph node if possible. // Will append to an existing command buffer/graph node if possible.
......
...@@ -837,6 +837,17 @@ angle::Result WindowSurfaceVk::nextSwapchainImage(DisplayVk *displayVk) ...@@ -837,6 +837,17 @@ angle::Result WindowSurfaceVk::nextSwapchainImage(DisplayVk *displayVk)
SwapchainImage &image = mSwapchainImages[mCurrentSwapchainImageIndex]; SwapchainImage &image = mSwapchainImages[mCurrentSwapchainImageIndex];
// This swap chain image is new, reset any dependency information it has.
//
// When the Vulkan backend is multithreading, different contexts can have very different current
// serials. If a surface is rendered to by multiple contexts in different frames, the last
// context to write a particular swap chain image has no bearing on the current context writing
// to that image.
//
// Clear the image's queue serial because it's possible that it appears to be in the future to
// the next context that writes to the image.
image.image.resetQueueSerial();
// Update RenderTarget pointers. // Update RenderTarget pointers.
mColorRenderTarget.updateSwapchainImage(&image.image, &image.imageView); mColorRenderTarget.updateSwapchainImage(&image.image, &image.imageView);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment