Fix offscreen drawing when cleaning up vulkan viewer.
When using offscreen draws, we save the "previous" frame in fLastImage in viewer. However this image holds a ref to the GrContext. When we were destroying the vulkan context we thought we were destroying the GrContext before the VkDevice but fLastImage was keeping it alive. This changes makes sure to reset fLastImage when we are done with it. Change-Id: Ib70e069a261f939217436a9f052d7565581cd230 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320263 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com> Auto-Submit: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
3d921f1b2c
commit
427d8ebf30
tools
@ -433,6 +433,7 @@ void VulkanWindowContext::destroyContext() {
|
||||
}
|
||||
}
|
||||
|
||||
SkASSERT(fContext->unique());
|
||||
fContext.reset();
|
||||
fInterface.reset();
|
||||
|
||||
|
@ -1530,6 +1530,8 @@ void Viewer::onPaint(SkSurface* surface) {
|
||||
|
||||
this->drawImGui();
|
||||
|
||||
fLastImage.reset();
|
||||
|
||||
if (auto direct = fWindow->directContext()) {
|
||||
// Clean out cache items that haven't been used in more than 10 seconds.
|
||||
direct->performDeferredCleanup(std::chrono::seconds(10));
|
||||
|
Loading…
Reference in New Issue
Block a user