diff options
Diffstat (limited to 'libs/hwui/renderthread/VulkanManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/VulkanManager.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp index 68c04afb2e08..2b9074499c2a 100644 --- a/libs/hwui/renderthread/VulkanManager.cpp +++ b/libs/hwui/renderthread/VulkanManager.cpp @@ -19,6 +19,7 @@ #include "DeviceInfo.h" #include "Properties.h" #include "RenderThread.h" +#include "renderstate/RenderState.h" #include <GrContext.h> #include <GrTypes.h> @@ -37,10 +38,14 @@ VulkanManager::VulkanManager(RenderThread& thread) : mRenderThread(thread) { void VulkanManager::destroy() { if (!hasVkContext()) return; + mRenderThread.renderState().onVkContextDestroyed(); + mRenderThread.setGrContext(nullptr); + if (VK_NULL_HANDLE != mCommandPool) { mDestroyCommandPool(mBackendContext->fDevice, mCommandPool, nullptr); mCommandPool = VK_NULL_HANDLE; } + mBackendContext.reset(); } void VulkanManager::initialize() { @@ -105,6 +110,8 @@ void VulkanManager::initialize() { if (Properties::enablePartialUpdates && Properties::useBufferAge) { mSwapBehavior = SwapBehavior::BufferAge; } + + mRenderThread.renderState().onVkContextCreated(); } // Returns the next BackbufferInfo to use for the next draw. The function will make sure all @@ -156,6 +163,9 @@ SkSurface* VulkanManager::getBackbufferSurface(VulkanSurface* surface) { if (!createSwapchain(surface)) { return nullptr; } + backbuffer = getAvailableBackbuffer(surface); + res = mResetFences(mBackendContext->fDevice, 2, backbuffer->mUsageFences); + SkASSERT(VK_SUCCESS == res); // acquire the image res = mAcquireNextImageKHR(mBackendContext->fDevice, surface->mSwapchain, UINT64_MAX, |