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
This commit is contained in:
egdaniel 2016-09-27 09:03:05 -07:00 committed by Commit bot
parent cfdd64f41f
commit 25661bac77
4 changed files with 21 additions and 0 deletions

View File

@ -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);

View File

@ -86,6 +86,7 @@ public:
private:
enum VkVendor {
kQualcomm_VkVendor = 20803,
kNvidia_VkVendor = 4318,
};
void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,

View File

@ -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,

View File

@ -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;
}