aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkRenderTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/vk/GrVkRenderTarget.cpp')
-rw-r--r--src/gpu/vk/GrVkRenderTarget.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index 2a745ed51c..c5a8628cc4 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -39,7 +39,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fResolveAttachmentView(resolveAttachmentView)
, fFramebuffer(nullptr)
, fCachedSimpleRenderPass(nullptr) {
- SkASSERT(desc.fSampleCnt > 1);
+ SkASSERT(desc.fSampleCnt);
this->createFramebuffer(gpu);
this->registerWithCache(budgeted);
}
@@ -62,7 +62,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fResolveAttachmentView(resolveAttachmentView)
, fFramebuffer(nullptr)
, fCachedSimpleRenderPass(nullptr) {
- SkASSERT(desc.fSampleCnt > 1);
+ SkASSERT(desc.fSampleCnt);
this->createFramebuffer(gpu);
}
@@ -82,7 +82,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fResolveAttachmentView(nullptr)
, fFramebuffer(nullptr)
, fCachedSimpleRenderPass(nullptr) {
- SkASSERT(1 == desc.fSampleCnt);
+ SkASSERT(!desc.fSampleCnt);
this->createFramebuffer(gpu);
this->registerWithCache(budgeted);
}
@@ -102,7 +102,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fResolveAttachmentView(nullptr)
, fFramebuffer(nullptr)
, fCachedSimpleRenderPass(nullptr) {
- SkASSERT(1 == desc.fSampleCnt);
+ SkASSERT(!desc.fSampleCnt);
this->createFramebuffer(gpu);
}
@@ -121,7 +121,7 @@ GrVkRenderTarget::Create(GrVkGpu* gpu,
// create msaa surface if necessary
GrVkImageInfo msInfo;
const GrVkImageView* resolveAttachmentView = nullptr;
- if (desc.fSampleCnt > 1) {
+ if (desc.fSampleCnt) {
GrVkImage::ImageDesc msImageDesc;
msImageDesc.fImageType = VK_IMAGE_TYPE_2D;
msImageDesc.fFormat = pixelFormat;
@@ -158,7 +158,7 @@ GrVkRenderTarget::Create(GrVkGpu* gpu,
const GrVkImageView* colorAttachmentView = GrVkImageView::Create(gpu, colorImage, pixelFormat,
GrVkImageView::kColor_Type, 1);
if (!colorAttachmentView) {
- if (desc.fSampleCnt > 1) {
+ if (desc.fSampleCnt) {
resolveAttachmentView->unref(gpu);
GrVkImage::DestroyImageInfo(gpu, &msInfo);
}
@@ -166,7 +166,7 @@ GrVkRenderTarget::Create(GrVkGpu* gpu,
}
GrVkRenderTarget* texRT;
- if (desc.fSampleCnt > 1) {
+ if (desc.fSampleCnt) {
texRT = new GrVkRenderTarget(gpu, budgeted, desc, info, msInfo,
colorAttachmentView, resolveAttachmentView, ownership);
} else {
@@ -237,10 +237,11 @@ void GrVkRenderTarget::createFramebuffer(GrVkGpu* gpu) {
void GrVkRenderTarget::getAttachmentsDescriptor(
GrVkRenderPass::AttachmentsDescriptor* desc,
GrVkRenderPass::AttachmentFlags* attachmentFlags) const {
+ int colorSamples = this->numColorSamples();
VkFormat colorFormat;
GrPixelConfigToVkFormat(this->config(), &colorFormat);
desc->fColor.fFormat = colorFormat;
- desc->fColor.fSamples = this->numColorSamples();
+ desc->fColor.fSamples = colorSamples ? colorSamples : 1;
*attachmentFlags = GrVkRenderPass::kColor_AttachmentFlag;
uint32_t attachmentCount = 1;
@@ -248,7 +249,7 @@ void GrVkRenderTarget::getAttachmentsDescriptor(
if (stencil) {
const GrVkStencilAttachment* vkStencil = static_cast<const GrVkStencilAttachment*>(stencil);
desc->fStencil.fFormat = vkStencil->vkFormat();
- desc->fStencil.fSamples = vkStencil->numSamples();
+ desc->fStencil.fSamples = vkStencil->numSamples() ? vkStencil->numSamples() : 1;
// Currently in vulkan stencil and color attachments must all have same number of samples
SkASSERT(desc->fColor.fSamples == desc->fStencil.fSamples);
*attachmentFlags |= GrVkRenderPass::kStencil_AttachmentFlag;