Fix vk framebuffer attachment views to only have 1 mip level.

Bug: skia:10979
Change-Id: Ib7329056a72d2dd2255758ee992dbf93578ee12b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347858
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2020-12-28 10:39:28 -05:00 committed by Skia Commit-Bot
parent b5d30dc414
commit 831e13324a
2 changed files with 12 additions and 8 deletions

View File

@ -199,16 +199,18 @@ sk_sp<GrVkRenderTarget> GrVkRenderTarget::MakeWrappedRenderTarget(
colorAttachmentView = sk_ref_sp<const GrVkImageView>(vkMSAAAttachment->view());
// Create Resolve attachment view
// Create Resolve attachment view. Attachment views on framebuffers must have a single mip
// level.
resolveAttachmentView =
GrVkImageView::Make(gpu, info.fImage, pixelFormat, GrVkImageView::kColor_Type, 1,
GrVkYcbcrConversionInfo());
GrVkImageView::Make(gpu, info.fImage, pixelFormat, GrVkImageView::kColor_Type,
/*miplevels=*/1, GrVkYcbcrConversionInfo());
if (!resolveAttachmentView) {
return nullptr;
}
} else {
// Attachment views on framebuffers must have a single mip level.
colorAttachmentView = GrVkImageView::Make(gpu, info.fImage, pixelFormat,
GrVkImageView::kColor_Type, 1,
GrVkImageView::kColor_Type, /*miplevels=*/1,
GrVkYcbcrConversionInfo());
}

View File

@ -130,7 +130,7 @@ static Views create_views(GrVkGpu* gpu, SkISize dimensions, int sampleCnt,
auto rp = gpu->getContext()->priv().resourceProvider();
sk_sp<GrAttachment> msaaAttachment =
rp->makeMSAAAttachment(dimensions, GrBackendFormat::MakeVk(info.fFormat),
sampleCnt, info.fProtected);
sampleCnt, info.fProtected);
if (!msaaAttachment) {
return {};
}
@ -140,16 +140,18 @@ static Views create_views(GrVkGpu* gpu, SkISize dimensions, int sampleCnt,
views.colorAttachmentView = sk_ref_sp<const GrVkImageView>(views.msaaAttachment->view());
// Create resolve attachment view.
// Create resolve attachment view. Attachment views on framebuffers must have a single mip
// level.
views.resolveAttachmentView =
GrVkImageView::Make(gpu, image, pixelFormat, GrVkImageView::kColor_Type,
info.fLevelCount, GrVkYcbcrConversionInfo());
/*miplevels=*/1, GrVkYcbcrConversionInfo());
if (!views.resolveAttachmentView) {
return {};
}
} else {
//Attachment views on framebuffers must have a single mip level.
views.colorAttachmentView = GrVkImageView::Make(
gpu, info.fImage, pixelFormat, GrVkImageView::kColor_Type, 1,
gpu, info.fImage, pixelFormat, GrVkImageView::kColor_Type, /*miplevels=*/1,
GrVkYcbcrConversionInfo());
}