Add command buffer submits before copy calls in vulkan.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2363773006
Review-Url: https://codereview.chromium.org/2363773006
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 7669ba5..22cffe7 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -74,6 +74,10 @@
fAllowInitializationErrorOnTearDown = true;
}
+ if (kNvidia_VkVendor == properties.vendorID) {
+ fSupportsCopiesAsDraws = true;
+ }
+
this->applyOptionsOverrides(contextOptions);
GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
glslCaps->applyOptionsOverrides(contextOptions);
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index 8e8953e..b0a6f46 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -86,6 +86,7 @@
private:
enum VkVendor {
kQualcomm_VkVendor = 20803,
+ kNvidia_VkVendor = 4318,
};
void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
diff --git a/src/gpu/vk/GrVkCommandBuffer.h b/src/gpu/vk/GrVkCommandBuffer.h
index 9864ec0..8020c7d 100644
--- a/src/gpu/vk/GrVkCommandBuffer.h
+++ b/src/gpu/vk/GrVkCommandBuffer.h
@@ -41,6 +41,8 @@
void bindVertexBuffer(GrVkGpu* gpu, GrVkVertexBuffer* vbuffer) {
VkBuffer vkBuffer = vbuffer->buffer();
+ // TODO: once vbuffer->offset() no longer always returns 0, we will need to track the offset
+ // to know if we can skip binding or not.
if (!fBoundVertexBufferIsValid || vkBuffer != fBoundVertexBuffer) {
VkDeviceSize offset = vbuffer->offset();
GR_VK_CALL(gpu->vkInterface(), CmdBindVertexBuffers(fCmdBuffer,
@@ -56,6 +58,8 @@
void bindIndexBuffer(GrVkGpu* gpu, GrVkIndexBuffer* ibuffer) {
VkBuffer vkBuffer = ibuffer->buffer();
+ // TODO: once ibuffer->offset() no longer always returns 0, we will need to track the offset
+ // to know if we can skip binding or not.
if (!fBoundIndexBufferIsValid || vkBuffer != fBoundIndexBuffer) {
GR_VK_CALL(gpu->vkInterface(), CmdBindIndexBuffer(fCmdBuffer,
vkBuffer,
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index a72b517..ec68040 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -380,6 +380,10 @@
SkASSERT(dst);
SkASSERT(src && src->numColorSamples() > 1 && src->msaaImage());
+#if defined(SK_BUILD_FOR_WIN)
+ this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue);
+#endif
+
// Flip rect if necessary
SkIRect srcVkRect = srcRect;
int32_t dstY = dstPoint.fY;
@@ -843,6 +847,10 @@
return;
}
+#if defined(SK_BUILD_FOR_WIN)
+ this->submitCommandBuffer(kSkip_SyncQueue);
+#endif
+
// We may need to resolve the texture first if it is also a render target
GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(tex->asRenderTarget());
if (texRT) {
@@ -1577,6 +1585,10 @@
return true;
}
+#if defined(SK_BUILD_FOR_WIN)
+ this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue);
+#endif
+
if (fCopyManager.copySurfaceAsDraw(this, dst, src, srcRect, dstPoint)) {
return true;
}