Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Unified Diff: src/gpu/vk/GrVkGpuCommandBuffer.cpp

Issue 2336763002: Lots of little cleanup improvements to Vulkan (Closed)
Patch Set: [ Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpuCommandBuffer.h ('k') | src/gpu/vk/GrVkPipeline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpuCommandBuffer.cpp
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index e3c7cb77cc2692fd50464d93b14a358b4253330f..a9d8e68d0016b81ef282418d7a0d7d59cf8a94e7 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -57,7 +57,8 @@ GrVkGpuCommandBuffer::GrVkGpuCommandBuffer(GrVkGpu* gpu,
const LoadAndStoreInfo& stencilInfo)
: fGpu(gpu)
, fRenderTarget(target)
- , fIsEmpty(true) {
+ , fIsEmpty(true)
+ , fStartsWithClear(false) {
VkAttachmentLoadOp vkLoadOp;
VkAttachmentStoreOp vkStoreOp;
@@ -101,6 +102,12 @@ void GrVkGpuCommandBuffer::end() {
}
void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) {
+ if (fIsEmpty && !fStartsWithClear) {
+ // We have sumbitted no actual draw commands to the command buffer and we are not using
+ // the render pass to do a clear so there is no need to submit anything.
+ return;
+ }
+
// 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()
@@ -155,6 +162,7 @@ void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) {
SkASSERT(fRenderPass->isCompatible(*oldRP));
oldRP->unref(fGpu);
+ fStartsWithClear = false;
}
}
@@ -252,6 +260,7 @@ void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const GrFixedClip& cl
oldRP->unref(fGpu);
GrColorToRGBAFloat(color, fColorClearValue.color.float32);
+ fStartsWithClear = true;
return;
}
« no previous file with comments | « src/gpu/vk/GrVkGpuCommandBuffer.h ('k') | src/gpu/vk/GrVkPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698