Send correct clear count to vulkan beginRenderPass

This technically wasn't an error but fixes a warning in the validation
layers.

Bug: skia:
Change-Id: I3d0d0aa3a29b5a08f145ceabedb9357791d36cb2
Reviewed-on: https://skia-review.googlesource.com/109881
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2018-02-23 16:08:28 -05:00 committed by Skia Commit-Bot
parent 5279cdf190
commit b68319a4b7
2 changed files with 3 additions and 11 deletions

View File

@ -403,15 +403,7 @@ void GrVkPrimaryCommandBuffer::beginRenderPass(const GrVkGpu* gpu,
beginInfo.renderPass = renderPass->vkRenderPass();
beginInfo.framebuffer = target.framebuffer()->framebuffer();
beginInfo.renderArea = renderArea;
// TODO: have clearValueCount return the index of the last attachment that
// requires a clear instead of the number of total clears.
uint32_t stencilIndex;
if (renderPass->stencilAttachmentIndex(&stencilIndex)) {
beginInfo.clearValueCount = renderPass->clearValueCount() ? 2 : 0;
} else {
beginInfo.clearValueCount = renderPass->clearValueCount();
}
beginInfo.clearValueCount = renderPass->clearValueCount();
beginInfo.pClearValues = clearValues;
VkSubpassContents contents = forSecondaryCB ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS

View File

@ -86,7 +86,7 @@ void GrVkRenderPass::init(const GrVkGpu* gpu,
subpassDesc.colorAttachmentCount = 1;
if (VK_ATTACHMENT_LOAD_OP_CLEAR == colorOp.fLoadOp) {
fClearValueCount++;
fClearValueCount = colorRef.attachment + 1;
}
} else {
// I don't think there should ever be a time where we don't have a color attachment
@ -107,7 +107,7 @@ void GrVkRenderPass::init(const GrVkGpu* gpu,
stencilRef.attachment = currentAttachment++;
stencilRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
if (VK_ATTACHMENT_LOAD_OP_CLEAR == stencilOp.fLoadOp) {
fClearValueCount++;
fClearValueCount = SkTMax(fClearValueCount, stencilRef.attachment + 1);
}
} else {
stencilRef.attachment = VK_ATTACHMENT_UNUSED;