diff options
author | 2016-09-27 09:03:05 -0700 | |
---|---|---|
committer | 2016-09-27 09:03:05 -0700 | |
commit | 25661bac7722860b7589c5b01ec404531d941456 (patch) | |
tree | 890750faf8432c309684d384fc3778f54172385f | |
parent | cfdd64f41f957d7465658c42dfa39802dd6c702c (diff) |
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
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 4 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCaps.h | 1 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCommandBuffer.h | 4 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 12 |
4 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 7669ba541a..22cffe7450 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -74,6 +74,10 @@ void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* 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 8e8953e522..b0a6f46578 100644 --- a/src/gpu/vk/GrVkCaps.h +++ b/src/gpu/vk/GrVkCaps.h @@ -86,6 +86,7 @@ public: 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 9864ec02fe..8020c7db14 100644 --- a/src/gpu/vk/GrVkCommandBuffer.h +++ b/src/gpu/vk/GrVkCommandBuffer.h @@ -41,6 +41,8 @@ public: 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 @@ public: 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 a72b517340..ec6804013d 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -380,6 +380,10 @@ void GrVkGpu::resolveImage(GrVkRenderTarget* dst, GrVkRenderTarget* src, const S 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 @@ void GrVkGpu::generateMipmap(GrVkTexture* tex) { 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 @@ bool GrVkGpu::onCopySurface(GrSurface* dst, return true; } +#if defined(SK_BUILD_FOR_WIN) + this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue); +#endif + if (fCopyManager.copySurfaceAsDraw(this, dst, src, srcRect, dstPoint)) { return true; } |