Index: src/gpu/vk/GrVkGpuCommandBuffer.cpp |
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
index 77a038a9577999a245c829427d31298e9495978a..f49b180e3823819eb3ced86d733d072bdf87071e 100644 |
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
@@ -100,12 +100,15 @@ void GrVkGpuCommandBuffer::end() { |
} |
void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { |
- // Change layout of our render target so it can be used as the color attachment |
- fRenderTarget->setImageLayout(fGpu, |
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
- VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, |
- VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, |
- false); |
+ // Change layout of our render target so it can be used as the color attachment. Currently |
+ // we don't attach the resolve to the framebuffer so no need to change its layout. |
+ GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaImage() |
+ : fRenderTarget; |
+ targetImage->setImageLayout(fGpu, |
+ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
+ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, |
+ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, |
+ false); |
// If we are using a stencil attachment we also need to update its layout |
if (GrStencilAttachment* stencil = fRenderTarget->renderTargetPriv().getStencilAttachment()) { |
@@ -118,14 +121,6 @@ void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { |
false); |
} |
- if (GrVkImage* msaaImage = fRenderTarget->msaaImage()) { |
- msaaImage->setImageLayout(fGpu, |
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
- VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, |
- VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, |
- false); |
- } |
- |
for (int i = 0; i < fSampledImages.count(); ++i) { |
fSampledImages[i]->setImageLayout(fGpu, |
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, |