Index: src/gpu/vk/GrVkGpuCommandBuffer.cpp |
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
index b2336495a9ce837c70bd0ee06723c87d600a98fd..4312683342368a7888434a1f17670ec6a5d80831 100644 |
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp |
@@ -7,6 +7,7 @@ |
#include "GrVkGpuCommandBuffer.h" |
+#include "GrFixedClip.h" |
#include "GrMesh.h" |
#include "GrPipeline.h" |
#include "GrRenderTargetPriv.h" |
@@ -171,8 +172,8 @@ void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) { |
} |
void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
- const SkIRect& rect, |
- bool insideClip) { |
+ const GrFixedClip& clip, |
+ bool insideStencilMask) { |
SkASSERT(target); |
GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
@@ -187,7 +188,7 @@ void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
VkClearDepthStencilValue vkStencilColor; |
memset(&vkStencilColor, 0, sizeof(VkClearDepthStencilValue)); |
- if (insideClip) { |
+ if (insideStencilMask) { |
vkStencilColor.stencil = (1 << (stencilBitCount - 1)); |
} else { |
vkStencilColor.stencil = 0; |
@@ -195,11 +196,12 @@ void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
VkClearRect clearRect; |
// Flip rect if necessary |
- SkIRect vkRect = rect; |
- |
+ SkIRect vkRect = clip.scissorEnabled() ? clip.scissorRect() |
+ : SkIRect::MakeWH(vkRT->width(), vkRT->height()); |
egdaniel
2016/08/19 20:09:37
For some minimal optimization, we don't need to do
csmartdalton
2016/08/19 20:46:49
Done. Looks better now.
|
if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { |
- vkRect.fTop = vkRT->height() - rect.fBottom; |
- vkRect.fBottom = vkRT->height() - rect.fTop; |
+ SkTSwap(vkRect.fTop, vkRect.fBottom); |
+ vkRect.fTop = vkRT->height() - vkRect.fTop; |
+ vkRect.fBottom = vkRT->height() - vkRect.fBottom; |
} |
clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; |
@@ -220,7 +222,7 @@ void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
fIsEmpty = false; |
} |
-void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const SkIRect& rect, GrColor color) { |
+void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const GrFixedClip& clip, GrColor color) { |
// parent class should never let us get here with no RT |
SkASSERT(target); |
@@ -229,7 +231,7 @@ void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const SkIRect& rect, |
GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
- if (fIsEmpty && rect.width() == target->width() && rect.height() == target->height()) { |
+ if (fIsEmpty && !clip.scissorEnabled()) { |
// We will change the render pass to do a clear load instead |
GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_CLEAR, |
VK_ATTACHMENT_STORE_OP_STORE); |
@@ -264,10 +266,12 @@ void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const SkIRect& rect, |
// We always do a sub rect clear with clearAttachments since we are inside a render pass |
VkClearRect clearRect; |
// Flip rect if necessary |
- SkIRect vkRect = rect; |
+ SkIRect vkRect = clip.scissorEnabled() ? clip.scissorRect() |
+ : SkIRect::MakeWH(vkRT->width(), vkRT->height()); |
if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { |
- vkRect.fTop = vkRT->height() - rect.fBottom; |
- vkRect.fBottom = vkRT->height() - rect.fTop; |
+ SkTSwap(vkRect.fTop, vkRect.fBottom); |
+ vkRect.fTop = vkRT->height() - vkRect.fTop; |
+ vkRect.fBottom = vkRT->height() - vkRect.fBottom; |
} |
clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; |
clearRect.rect.extent = { (uint32_t)vkRect.width(), (uint32_t)vkRect.height() }; |