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