aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkGpuCommandBuffer.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-08-09 10:28:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-09 15:01:34 +0000
commit74c627f0bde675f13587b12069d6556868edf45e (patch)
treea3022c997863a7f271eee66b3e9cfadaefb4f3b0 /src/gpu/vk/GrVkGpuCommandBuffer.cpp
parent19e51dcd1eb0bcdc70f29620ce4ca30ddbfc2042 (diff)
Fix stencil clear load in Vulkan
A later clear call was nuking the stencil clear load setting. Bug: skia:6936 Change-Id: Ib2c5cd930273cd6e613ca7191f8b7806abe6c218 Reviewed-on: https://skia-review.googlesource.com/32541 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/vk/GrVkGpuCommandBuffer.cpp')
-rw-r--r--src/gpu/vk/GrVkGpuCommandBuffer.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 65445264c5..6378251d3d 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -120,13 +120,6 @@ GrVkGpuCommandBuffer::~GrVkGpuCommandBuffer() {
GrGpu* GrVkGpuCommandBuffer::gpu() { return fGpu; }
-void GrVkGpuCommandBuffer::begin() {
- // TODO: remove this - see skbug.com/6936
- if (VK_ATTACHMENT_LOAD_OP_CLEAR == fVkStencilLoadOp) {
- fGpu->clearStencil(fRenderTarget, 0x0);
- }
-}
-
void GrVkGpuCommandBuffer::end() {
if (fCurrentCmdInfo >= 0) {
fCommandBufferInfos[fCurrentCmdInfo].currentCmdBuf()->end(fGpu);
@@ -173,7 +166,7 @@ void GrVkGpuCommandBuffer::onSubmit() {
// TODO: We can't add this optimization yet since many things create a scratch texture which
// adds the discard immediately, but then don't draw to it right away. This causes the
// discard to be ignored and we get yelled at for loading uninitialized data. However, once
- // MDP lands, the discard will get reordered with the rest of the draw commands and we can
+ // MDB lands, the discard will get reordered with the rest of the draw commands and we can
// re-enable this.
#if 0
if (cbInfo.fIsEmpty && !cbInfo.fStartsWithClear) {
@@ -201,7 +194,7 @@ void GrVkGpuCommandBuffer::discard() {
CommandBufferInfo& cbInfo = fCommandBufferInfos[fCurrentCmdInfo];
if (cbInfo.fIsEmpty) {
- // We will change the render pass to do a clear load instead
+ // Change the render pass to do a don't-care load for both color & stencil
GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_DONT_CARE,
VK_ATTACHMENT_STORE_OP_STORE);
GrVkRenderPass::LoadStoreOps vkStencilOps(VK_ATTACHMENT_LOAD_OP_DONT_CARE,
@@ -304,11 +297,11 @@ void GrVkGpuCommandBuffer::onClear(const GrFixedClip& clip, GrColor color) {
GrColorToRGBAFloat(color, vkColor.float32);
if (cbInfo.fIsEmpty && !clip.scissorEnabled()) {
- // We will change the render pass to do a clear load instead
+ // Change the render pass to do a clear load
GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_CLEAR,
VK_ATTACHMENT_STORE_OP_STORE);
- GrVkRenderPass::LoadStoreOps vkStencilOps(VK_ATTACHMENT_LOAD_OP_LOAD,
- VK_ATTACHMENT_STORE_OP_STORE);
+ // Preserve the stencil buffer's load & store settings
+ GrVkRenderPass::LoadStoreOps vkStencilOps(fVkStencilLoadOp, fVkStencilStoreOp);
const GrVkRenderPass* oldRP = cbInfo.fRenderPass;