Commit 487dc474 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Vulkan: fix crash during reszing chrome window.

The crashes is becaued color spaces of DDL recorder colorspace and
framebuffer sk surfaces do not match.

Bug: none
Change-Id: Ib970536c78eb2a9452528b0f99deecc067446247
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866738Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707058}
parent 59cda402
......@@ -57,10 +57,13 @@ void SkiaOutputDeviceVulkan::Reshape(const gfx::Size& size,
vulkan_surface_->Reshape(size, transform);
if (vulkan_surface_->swap_chain_generation() != generation) {
auto sk_color_space = color_space.ToSkColorSpace();
if (vulkan_surface_->swap_chain_generation() != generation ||
!SkColorSpace::Equals(sk_color_space.get(), sk_color_space_.get())) {
// swapchain is changed, we need recreate all cached sk surfaces.
sk_surfaces_.clear();
sk_surfaces_.resize(vulkan_surface_->swap_chain()->num_images());
sk_color_space_ = std::move(sk_color_space);
}
}
......@@ -110,7 +113,7 @@ SkSurface* SkiaOutputDeviceVulkan::BeginPaint() {
: kRGBA_8888_SkColorType;
sk_surface = SkSurface::MakeFromBackendRenderTarget(
context_provider_->GetGrContext(), render_target,
kTopLeft_GrSurfaceOrigin, sk_color_type, nullptr /* color_space */,
kTopLeft_GrSurfaceOrigin, sk_color_type, sk_color_space_,
&surface_props);
DCHECK(sk_surface);
} else {
......
......@@ -55,6 +55,8 @@ class SkiaOutputDeviceVulkan final : public SkiaOutputDevice {
// SkSurfaces for swap chain images.
std::vector<sk_sp<SkSurface>> sk_surfaces_;
sk_sp<SkColorSpace> sk_color_space_;
DISALLOW_COPY_AND_ASSIGN(SkiaOutputDeviceVulkan);
};
......
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