Revert "switched GrVkCopyManager to use secondary command buffer instead of AMD-specific workaround"
This reverts commit 6dafa22edb37a0f35a1d04bb9f00e7effa5287c4.
Reason for revert: crashing pixel and pixel2 perf release bots
Original change's description:
> switched GrVkCopyManager to use secondary command buffer instead of AMD-specific workaround
>
> Bug: skia:
> Change-Id: I4f607b1ce7166b90c2984515f5f09eba74cb8ddb
> Reviewed-on: https://skia-review.googlesource.com/c/173995
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,ethannicholas@google.com
Change-Id: I4b69eb8adc97b4d481bc790985a846943b1d2d6b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/175420
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp
index f91b04e..fd91507 100644
--- a/src/gpu/vk/GrVkCopyManager.cpp
+++ b/src/gpu/vk/GrVkCopyManager.cpp
@@ -156,6 +156,11 @@
return false;
}
+ if (gpu->vkCaps().newCBOnPipelineChange()) {
+ // We bind a new pipeline here for the copy so we must start a new command buffer.
+ gpu->finishFlush(0, nullptr);
+ }
+
GrVkRenderTarget* rt = static_cast<GrVkRenderTarget*>(dst->asRenderTarget());
if (!rt) {
return false;
@@ -290,6 +295,8 @@
gpu->onResolveRenderTarget(texRT);
}
+ GrVkPrimaryCommandBuffer* cmdBuffer = gpu->currentCommandBuffer();
+
// TODO: Make tighter bounds and then adjust bounds for origin and granularity if we see
// any perf issues with using the whole bounds
SkIRect bounds = SkIRect::MakeWH(rt->width(), rt->height());
@@ -348,17 +355,9 @@
SkASSERT(renderPass->isCompatible(*rt->simpleRenderPass()));
- GrVkPrimaryCommandBuffer* cmdBuffer = gpu->currentCommandBuffer();
- cmdBuffer->beginRenderPass(gpu, renderPass, nullptr, *rt, bounds, true);
- GrVkSecondaryCommandBuffer* secondary =
- gpu->resourceProvider().findOrCreateSecondaryCommandBuffer();
- if (!secondary) {
- return false;
- }
- secondary->begin(gpu, rt->framebuffer(), renderPass);
-
- secondary->bindPipeline(gpu, pipeline);
+ cmdBuffer->beginRenderPass(gpu, renderPass, nullptr, *rt, bounds, false);
+ cmdBuffer->bindPipeline(gpu, pipeline);
// Uniform DescriptorSet, Sampler DescriptorSet, and vertex shader uniformBuffer
SkSTArray<3, const GrVkRecycledResource*> descriptorRecycledResources;
@@ -372,7 +371,7 @@
descriptorResources.push_back(srcTex->textureView());
descriptorResources.push_back(srcTex->resource());
- secondary->bindDescriptorSets(gpu,
+ cmdBuffer->bindDescriptorSets(gpu,
descriptorRecycledResources,
descriptorResources,
fPipelineLayout,
@@ -391,7 +390,7 @@
viewport.height = SkIntToScalar(rt->height());
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
- secondary->setViewport(gpu, 0, 1, &viewport);
+ cmdBuffer->setViewport(gpu, 0, 1, &viewport);
// We assume the scissor is not enabled so just set it to the whole RT
VkRect2D scissor;
@@ -399,14 +398,11 @@
scissor.extent.height = rt->height();
scissor.offset.x = 0;
scissor.offset.y = 0;
- secondary->setScissor(gpu, 0, 1, &scissor);
+ cmdBuffer->setScissor(gpu, 0, 1, &scissor);
- secondary->bindInputBuffer(gpu, 0, fVertexBuffer.get());
- secondary->draw(gpu, 4, 1, 0, 0);
- secondary->end(gpu);
- cmdBuffer->executeCommands(gpu, secondary);
+ cmdBuffer->bindInputBuffer(gpu, 0, fVertexBuffer.get());
+ cmdBuffer->draw(gpu, 4, 1, 0, 0);
cmdBuffer->endRenderPass(gpu);
- secondary->unref(gpu);
// Release all temp resources which should now be reffed by the cmd buffer
pipeline->unref(gpu);