OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
9 | 9 |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 373 } |
374 | 374 |
375 return success; | 375 return success; |
376 } | 376 } |
377 | 377 |
378 void GrVkGpu::resolveImage(GrVkRenderTarget* dst, GrVkRenderTarget* src, const S
kIRect& srcRect, | 378 void GrVkGpu::resolveImage(GrVkRenderTarget* dst, GrVkRenderTarget* src, const S
kIRect& srcRect, |
379 const SkIPoint& dstPoint) { | 379 const SkIPoint& dstPoint) { |
380 SkASSERT(dst); | 380 SkASSERT(dst); |
381 SkASSERT(src && src->numColorSamples() > 1 && src->msaaImage()); | 381 SkASSERT(src && src->numColorSamples() > 1 && src->msaaImage()); |
382 | 382 |
383 #if defined(SK_BUILD_FOR_WIN) | |
384 this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue); | |
385 #endif | |
386 | |
387 // Flip rect if necessary | 383 // Flip rect if necessary |
388 SkIRect srcVkRect = srcRect; | 384 SkIRect srcVkRect = srcRect; |
389 int32_t dstY = dstPoint.fY; | 385 int32_t dstY = dstPoint.fY; |
390 | 386 |
391 if (kBottomLeft_GrSurfaceOrigin == src->origin()) { | 387 if (kBottomLeft_GrSurfaceOrigin == src->origin()) { |
392 SkASSERT(kBottomLeft_GrSurfaceOrigin == dst->origin()); | 388 SkASSERT(kBottomLeft_GrSurfaceOrigin == dst->origin()); |
393 srcVkRect.fTop = src->height() - srcRect.fBottom; | 389 srcVkRect.fTop = src->height() - srcRect.fBottom; |
394 srcVkRect.fBottom = src->height() - srcRect.fTop; | 390 srcVkRect.fBottom = src->height() - srcRect.fTop; |
395 dstY = dst->height() - dstPoint.fY - srcVkRect.height(); | 391 dstY = dst->height() - dstPoint.fY - srcVkRect.height(); |
396 } | 392 } |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 836 } |
841 | 837 |
842 // determine if we can blit to and from this format | 838 // determine if we can blit to and from this format |
843 const GrVkCaps& caps = this->vkCaps(); | 839 const GrVkCaps& caps = this->vkCaps(); |
844 if (!caps.configCanBeDstofBlit(tex->config(), false) || | 840 if (!caps.configCanBeDstofBlit(tex->config(), false) || |
845 !caps.configCanBeSrcofBlit(tex->config(), false) || | 841 !caps.configCanBeSrcofBlit(tex->config(), false) || |
846 !caps.mipMapSupport()) { | 842 !caps.mipMapSupport()) { |
847 return; | 843 return; |
848 } | 844 } |
849 | 845 |
850 #if defined(SK_BUILD_FOR_WIN) | |
851 this->submitCommandBuffer(kSkip_SyncQueue); | |
852 #endif | |
853 | |
854 // We may need to resolve the texture first if it is also a render target | 846 // We may need to resolve the texture first if it is also a render target |
855 GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(tex->asRenderTarget
()); | 847 GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(tex->asRenderTarget
()); |
856 if (texRT) { | 848 if (texRT) { |
857 this->onResolveRenderTarget(texRT); | 849 this->onResolveRenderTarget(texRT); |
858 } | 850 } |
859 | 851 |
860 int width = tex->width(); | 852 int width = tex->width(); |
861 int height = tex->height(); | 853 int height = tex->height(); |
862 VkImageBlit blitRegion; | 854 VkImageBlit blitRegion; |
863 memset(&blitRegion, 0, sizeof(VkImageBlit)); | 855 memset(&blitRegion, 0, sizeof(VkImageBlit)); |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 | 1570 |
1579 bool GrVkGpu::onCopySurface(GrSurface* dst, | 1571 bool GrVkGpu::onCopySurface(GrSurface* dst, |
1580 GrSurface* src, | 1572 GrSurface* src, |
1581 const SkIRect& srcRect, | 1573 const SkIRect& srcRect, |
1582 const SkIPoint& dstPoint) { | 1574 const SkIPoint& dstPoint) { |
1583 if (can_copy_as_resolve(dst, src, this)) { | 1575 if (can_copy_as_resolve(dst, src, this)) { |
1584 this->copySurfaceAsResolve(dst, src, srcRect, dstPoint); | 1576 this->copySurfaceAsResolve(dst, src, srcRect, dstPoint); |
1585 return true; | 1577 return true; |
1586 } | 1578 } |
1587 | 1579 |
1588 #if defined(SK_BUILD_FOR_WIN) | |
1589 this->submitCommandBuffer(GrVkGpu::kSkip_SyncQueue); | |
1590 #endif | |
1591 | |
1592 if (fCopyManager.copySurfaceAsDraw(this, dst, src, srcRect, dstPoint)) { | 1580 if (fCopyManager.copySurfaceAsDraw(this, dst, src, srcRect, dstPoint)) { |
1593 return true; | 1581 return true; |
1594 } | 1582 } |
1595 | 1583 |
1596 GrVkImage* dstImage; | 1584 GrVkImage* dstImage; |
1597 GrVkImage* srcImage; | 1585 GrVkImage* srcImage; |
1598 GrRenderTarget* dstRT = dst->asRenderTarget(); | 1586 GrRenderTarget* dstRT = dst->asRenderTarget(); |
1599 if (dstRT) { | 1587 if (dstRT) { |
1600 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(dstRT); | 1588 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(dstRT); |
1601 dstImage = vkRT->numColorSamples() > 1 ? vkRT->msaaImage() : vkRT; | 1589 dstImage = vkRT->numColorSamples() > 1 ? vkRT->msaaImage() : vkRT; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment | 1869 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment |
1882 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment | 1870 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment |
1883 // which is always at the first attachment. | 1871 // which is always at the first attachment. |
1884 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); | 1872 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); |
1885 fCurrentCmdBuffer->executeCommands(this, buffer); | 1873 fCurrentCmdBuffer->executeCommands(this, buffer); |
1886 fCurrentCmdBuffer->endRenderPass(this); | 1874 fCurrentCmdBuffer->endRenderPass(this); |
1887 | 1875 |
1888 this->didWriteToSurface(target, &bounds); | 1876 this->didWriteToSurface(target, &bounds); |
1889 } | 1877 } |
1890 | 1878 |
OLD | NEW |