Chromium Code Reviews| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 return nullptr; | 703 return nullptr; |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 return tgt; | 706 return tgt; |
| 707 } | 707 } |
| 708 | 708 |
| 709 //////////////////////////////////////////////////////////////////////////////// | 709 //////////////////////////////////////////////////////////////////////////////// |
| 710 | 710 |
| 711 void GrVkGpu::bindGeometry(const GrPrimitiveProcessor& primProc, | 711 void GrVkGpu::bindGeometry(const GrPrimitiveProcessor& primProc, |
| 712 const GrNonInstancedMesh& mesh) { | 712 const GrNonInstancedMesh& mesh) { |
| 713 // There is no need to put any memory barriers to make sure host writes have finished here. | |
| 714 // When a command buffer is submitted to a queue, there is an implicit memor y barrier that | |
| 715 // occurs for all host writes. Additionally, BufferMemoryBarriers are not al lowed inside of | |
| 716 // an active RenderPass. | |
| 713 GrVkVertexBuffer* vbuf; | 717 GrVkVertexBuffer* vbuf; |
| 714 vbuf = (GrVkVertexBuffer*)mesh.vertexBuffer(); | 718 vbuf = (GrVkVertexBuffer*)mesh.vertexBuffer(); |
| 715 SkASSERT(vbuf); | 719 SkASSERT(vbuf); |
| 716 SkASSERT(!vbuf->isMapped()); | 720 SkASSERT(!vbuf->isMapped()); |
| 717 | 721 |
| 718 vbuf->addMemoryBarrier(this, | |
| 719 VK_ACCESS_HOST_WRITE_BIT, | |
| 720 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, | |
| 721 VK_PIPELINE_STAGE_HOST_BIT, | |
| 722 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, | |
| 723 false); | |
| 724 | |
| 725 fCurrentCmdBuffer->bindVertexBuffer(this, vbuf); | 722 fCurrentCmdBuffer->bindVertexBuffer(this, vbuf); |
| 726 | 723 |
| 727 if (mesh.isIndexed()) { | 724 if (mesh.isIndexed()) { |
| 728 GrVkIndexBuffer* ibuf = (GrVkIndexBuffer*)mesh.indexBuffer(); | 725 GrVkIndexBuffer* ibuf = (GrVkIndexBuffer*)mesh.indexBuffer(); |
| 729 SkASSERT(ibuf); | 726 SkASSERT(ibuf); |
| 730 SkASSERT(!ibuf->isMapped()); | 727 SkASSERT(!ibuf->isMapped()); |
| 731 | 728 |
| 732 ibuf->addMemoryBarrier(this, | |
| 733 VK_ACCESS_HOST_WRITE_BIT, | |
| 734 VK_ACCESS_INDEX_READ_BIT, | |
| 735 VK_PIPELINE_STAGE_HOST_BIT, | |
| 736 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, | |
| 737 false); | |
| 738 | |
| 739 fCurrentCmdBuffer->bindIndexBuffer(this, ibuf); | 729 fCurrentCmdBuffer->bindIndexBuffer(this, ibuf); |
| 740 } | 730 } |
| 741 } | 731 } |
| 742 | 732 |
| 743 //////////////////////////////////////////////////////////////////////////////// | 733 //////////////////////////////////////////////////////////////////////////////// |
| 744 | 734 |
| 745 GrStencilAttachment* GrVkGpu::createStencilAttachmentForRenderTarget(const GrRen derTarget* rt, | 735 GrStencilAttachment* GrVkGpu::createStencilAttachmentForRenderTarget(const GrRen derTarget* rt, |
| 746 int width, | 736 int width, |
| 747 int height) { | 737 int height) { |
| 748 SkASSERT(width >= rt->width()); | 738 SkASSERT(width >= rt->width()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 // TODO: Add support for copying to optimal tiling | 857 // TODO: Add support for copying to optimal tiling |
| 868 SkASSERT(false); | 858 SkASSERT(false); |
| 869 } | 859 } |
| 870 } | 860 } |
| 871 | 861 |
| 872 GrVkTextureInfo* info = new GrVkTextureInfo; | 862 GrVkTextureInfo* info = new GrVkTextureInfo; |
| 873 info->fImage = image; | 863 info->fImage = image; |
| 874 info->fAlloc = alloc; | 864 info->fAlloc = alloc; |
| 875 info->fImageTiling = imageTiling; | 865 info->fImageTiling = imageTiling; |
| 876 info->fImageLayout = initialLayout; | 866 info->fImageLayout = initialLayout; |
| 867 info->fFormat = pixelFormat; | |
| 877 | 868 |
| 878 return (GrBackendObject)info; | 869 return (GrBackendObject)info; |
| 879 } | 870 } |
| 880 | 871 |
| 881 bool GrVkGpu::isTestingOnlyBackendTexture(GrBackendObject id) const { | 872 bool GrVkGpu::isTestingOnlyBackendTexture(GrBackendObject id) const { |
| 882 const GrVkTextureInfo* backend = reinterpret_cast<const GrVkTextureInfo*>(id ); | 873 const GrVkTextureInfo* backend = reinterpret_cast<const GrVkTextureInfo*>(id ); |
| 883 | 874 |
| 884 if (backend && backend->fImage && backend->fAlloc) { | 875 if (backend && backend->fImage && backend->fAlloc) { |
| 885 VkMemoryRequirements req; | 876 VkMemoryRequirements req; |
| 886 memset(&req, 0, sizeof(req)); | 877 memset(&req, 0, sizeof(req)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 memset(&vkStencilColor, 0, sizeof(VkClearDepthStencilValue)); | 1008 memset(&vkStencilColor, 0, sizeof(VkClearDepthStencilValue)); |
| 1018 if (insideClip) { | 1009 if (insideClip) { |
| 1019 vkStencilColor.stencil = (1 << (stencilBitCount - 1)); | 1010 vkStencilColor.stencil = (1 << (stencilBitCount - 1)); |
| 1020 } else { | 1011 } else { |
| 1021 vkStencilColor.stencil = 0; | 1012 vkStencilColor.stencil = 0; |
| 1022 } | 1013 } |
| 1023 | 1014 |
| 1024 VkImageLayout origDstLayout = vkStencil->currentLayout(); | 1015 VkImageLayout origDstLayout = vkStencil->currentLayout(); |
| 1025 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstLayou t); | 1016 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstLayou t); |
| 1026 VkAccessFlags dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; | 1017 VkAccessFlags dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; |
| 1027 VkPipelineStageFlags srcStageMask = | 1018 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(o rigDstLayout); |
| 1028 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); | |
| 1029 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | 1019 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; |
| 1030 vkStencil->setImageLayout(this, | 1020 vkStencil->setImageLayout(this, |
| 1031 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, | 1021 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, |
| 1032 srcAccessMask, | 1022 srcAccessMask, |
| 1033 dstAccessMask, | 1023 dstAccessMask, |
| 1034 srcStageMask, | 1024 srcStageMask, |
| 1035 dstStageMask, | 1025 dstStageMask, |
| 1036 false); | 1026 false); |
| 1037 | 1027 |
| 1028 // Change layout of our render target so it can be used as the color attachm ent. This is what | |
| 1029 // the render pass expects when it begins. | |
| 1030 VkImageLayout layout = vkRT->currentLayout(); | |
| 1031 srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(layout); | |
| 1032 dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | |
| 1033 srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); | |
| 1034 dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | |
| 1035 vkRT->setImageLayout(this, | |
| 1036 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | |
| 1037 srcAccessMask, | |
| 1038 dstAccessMask, | |
| 1039 srcStageMask, | |
| 1040 dstStageMask, | |
| 1041 false); | |
| 1042 | |
| 1038 VkClearRect clearRect; | 1043 VkClearRect clearRect; |
| 1039 // Flip rect if necessary | 1044 // Flip rect if necessary |
| 1040 SkIRect vkRect = rect; | 1045 SkIRect vkRect = rect; |
| 1041 | 1046 |
| 1042 if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { | 1047 if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { |
| 1043 vkRect.fTop = vkRT->height() - rect.fBottom; | 1048 vkRect.fTop = vkRT->height() - rect.fBottom; |
| 1044 vkRect.fBottom = vkRT->height() - rect.fTop; | 1049 vkRect.fBottom = vkRT->height() - rect.fTop; |
| 1045 } | 1050 } |
| 1046 | 1051 |
| 1047 clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; | 1052 clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1074 | 1079 |
| 1075 VkClearColorValue vkColor; | 1080 VkClearColorValue vkColor; |
| 1076 GrColorToRGBAFloat(color, vkColor.float32); | 1081 GrColorToRGBAFloat(color, vkColor.float32); |
| 1077 | 1082 |
| 1078 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | 1083 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
| 1079 VkImageLayout origDstLayout = vkRT->currentLayout(); | 1084 VkImageLayout origDstLayout = vkRT->currentLayout(); |
| 1080 | 1085 |
| 1081 if (rect.width() != target->width() || rect.height() != target->height()) { | 1086 if (rect.width() != target->width() || rect.height() != target->height()) { |
| 1082 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL ayout); | 1087 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL ayout); |
| 1083 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | 1088 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
| 1084 VkPipelineStageFlags srcStageMask = | 1089 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFla gs(origDstLayout); |
| 1085 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); | |
| 1086 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | 1090 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; |
| 1087 vkRT->setImageLayout(this, | 1091 vkRT->setImageLayout(this, |
| 1088 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 1092 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
| 1089 srcAccessMask, | 1093 srcAccessMask, |
| 1090 dstAccessMask, | 1094 dstAccessMask, |
| 1091 srcStageMask, | 1095 srcStageMask, |
| 1092 dstStageMask, | 1096 dstStageMask, |
| 1093 false); | 1097 false); |
| 1094 | 1098 |
| 1099 // If we are using a stencil attachment we also need to change its layou t to what the render | |
| 1100 // pass is expecting. | |
| 1101 if (GrStencilAttachment* stencil = vkRT->renderTargetPriv().getStencilAt tachment()) { | |
| 1102 GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil; | |
| 1103 origDstLayout = vkStencil->currentLayout(); | |
| 1104 srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstLayout); | |
| 1105 dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | | |
| 1106 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; | |
| 1107 srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(origDstLayout) ; | |
| 1108 dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | |
| 1109 vkStencil->setImageLayout(this, | |
| 1110 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_O PTIMAL, | |
| 1111 srcAccessMask, | |
| 1112 dstAccessMask, | |
| 1113 srcStageMask, | |
| 1114 dstStageMask, | |
| 1115 false); | |
| 1116 } | |
| 1117 | |
| 1095 VkClearRect clearRect; | 1118 VkClearRect clearRect; |
| 1096 // Flip rect if necessary | 1119 // Flip rect if necessary |
| 1097 SkIRect vkRect = rect; | 1120 SkIRect vkRect = rect; |
| 1098 if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { | 1121 if (kBottomLeft_GrSurfaceOrigin == vkRT->origin()) { |
| 1099 vkRect.fTop = vkRT->height() - rect.fBottom; | 1122 vkRect.fTop = vkRT->height() - rect.fBottom; |
| 1100 vkRect.fBottom = vkRT->height() - rect.fTop; | 1123 vkRect.fBottom = vkRT->height() - rect.fTop; |
| 1101 } | 1124 } |
| 1102 clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; | 1125 clearRect.rect.offset = { vkRect.fLeft, vkRect.fTop }; |
| 1103 clearRect.rect.extent = { (uint32_t)vkRect.width(), (uint32_t)vkRect.hei ght() }; | 1126 clearRect.rect.extent = { (uint32_t)vkRect.width(), (uint32_t)vkRect.hei ght() }; |
| 1104 clearRect.baseArrayLayer = 0; | 1127 clearRect.baseArrayLayer = 0; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1567 const GrMesh* meshes, | 1590 const GrMesh* meshes, |
| 1568 int meshCount) { | 1591 int meshCount) { |
| 1569 if (!meshCount) { | 1592 if (!meshCount) { |
| 1570 return; | 1593 return; |
| 1571 } | 1594 } |
| 1572 GrRenderTarget* rt = pipeline.getRenderTarget(); | 1595 GrRenderTarget* rt = pipeline.getRenderTarget(); |
| 1573 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); | 1596 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); |
| 1574 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); | 1597 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); |
| 1575 SkASSERT(renderPass); | 1598 SkASSERT(renderPass); |
| 1576 | 1599 |
| 1577 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT); | |
| 1578 | 1600 |
| 1579 GrPrimitiveType primitiveType = meshes[0].primitiveType(); | 1601 GrPrimitiveType primitiveType = meshes[0].primitiveType(); |
| 1580 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, | 1602 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, |
| 1581 primProc, | 1603 primProc, |
| 1582 primitiveTyp e, | 1604 primitiveTyp e, |
| 1583 *renderPass) ; | 1605 *renderPass) ; |
| 1584 if (!pipelineState) { | 1606 if (!pipelineState) { |
| 1585 return; | 1607 return; |
| 1586 } | 1608 } |
| 1587 | 1609 |
| 1588 // Change layout of our render target so it can be used as the color attachm ent | 1610 // Change layout of our render target so it can be used as the color attachm ent |
| 1589 VkImageLayout layout = vkRT->currentLayout(); | 1611 VkImageLayout layout = vkRT->currentLayout(); |
| 1590 // Our color attachment is purely a destination and won't be read so don't n eed to flush or | |
| 1591 // invalidate any caches | |
| 1592 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(l ayout); | 1612 VkPipelineStageFlags srcStageMask = GrVkMemory::LayoutToPipelineStageFlags(l ayout); |
| 1593 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | 1613 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; |
| 1594 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); | 1614 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(layout); |
| 1595 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | 1615 VkAccessFlags dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
| 1596 vkRT->setImageLayout(this, | 1616 vkRT->setImageLayout(this, |
| 1597 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 1617 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
| 1598 srcAccessMask, | 1618 srcAccessMask, |
| 1599 dstAccessMask, | 1619 dstAccessMask, |
| 1600 srcStageMask, | 1620 srcStageMask, |
| 1601 dstStageMask, | 1621 dstStageMask, |
| 1602 false); | 1622 false); |
| 1603 | 1623 |
| 1604 // If we are using a stencil attachment we also need to update its layout | 1624 // If we are using a stencil attachment we also need to update its layout |
| 1605 if (!pipeline.getStencil().isDisabled()) { | 1625 if (GrStencilAttachment* stencil = vkRT->renderTargetPriv().getStencilAttach ment()) { |
| 1606 GrStencilAttachment* stencil = vkRT->renderTargetPriv().getStencilAttach ment(); | |
| 1607 GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil; | 1626 GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil; |
| 1608 VkImageLayout origDstLayout = vkStencil->currentLayout(); | 1627 VkImageLayout origDstLayout = vkStencil->currentLayout(); |
| 1609 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL ayout); | 1628 VkAccessFlags srcAccessMask = GrVkMemory::LayoutToSrcAccessMask(origDstL ayout); |
| 1610 VkAccessFlags dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_B IT | | 1629 VkAccessFlags dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_B IT | |
| 1611 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; | 1630 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; |
| 1612 VkPipelineStageFlags srcStageMask = | 1631 VkPipelineStageFlags srcStageMask = |
| 1613 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); | 1632 GrVkMemory::LayoutToPipelineStageFlags(origDstLayout); |
| 1614 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; | 1633 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; |
| 1615 vkStencil->setImageLayout(this, | 1634 vkStencil->setImageLayout(this, |
| 1616 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM AL, | 1635 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM AL, |
| 1617 srcAccessMask, | 1636 srcAccessMask, |
| 1618 dstAccessMask, | 1637 dstAccessMask, |
| 1619 srcStageMask, | 1638 srcStageMask, |
| 1620 dstStageMask, | 1639 dstStageMask, |
| 1621 false); | 1640 false); |
| 1622 } | 1641 } |
| 1623 | 1642 |
| 1643 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT); | |
| 1624 | 1644 |
| 1625 for (int i = 0; i < meshCount; ++i) { | 1645 for (int i = 0; i < meshCount; ++i) { |
| 1626 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) { | 1646 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) { |
| 1627 this->xferBarrier(pipeline.getRenderTarget(), barrierType); | 1647 this->xferBarrier(pipeline.getRenderTarget(), barrierType); |
|
jvanverth1
2016/04/21 13:25:24
Why are we bothering to call this? It does nothing
egdaniel
2016/04/21 14:09:20
gone
| |
| 1628 } | 1648 } |
| 1629 | 1649 |
| 1630 const GrMesh& mesh = meshes[i]; | 1650 const GrMesh& mesh = meshes[i]; |
| 1631 GrMesh::Iterator iter; | 1651 GrMesh::Iterator iter; |
| 1632 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); | 1652 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); |
| 1633 do { | 1653 do { |
| 1634 if (nonIdxMesh->primitiveType() != primitiveType) { | 1654 if (nonIdxMesh->primitiveType() != primitiveType) { |
| 1635 // Technically we don't have to call this here (since there is a safety check in | 1655 // Technically we don't have to call this here (since there is a safety check in |
| 1636 // pipelineState:setData but this will allow for quicker freeing of resources if the | 1656 // pipelineState:setData but this will allow for quicker freeing of resources if the |
| 1637 // pipelineState sits in a cache for a while. | 1657 // pipelineState sits in a cache for a while. |
| 1638 pipelineState->freeTempResources(this); | 1658 pipelineState->freeTempResources(this); |
| 1639 SkDEBUGCODE(pipelineState = nullptr); | 1659 SkDEBUGCODE(pipelineState = nullptr); |
| 1640 primitiveType = nonIdxMesh->primitiveType(); | 1660 primitiveType = nonIdxMesh->primitiveType(); |
| 1661 // It is illegal for us to have the necessary memory barriers fo r when we write and | |
| 1662 // update the uniform buffers in prepareDrawState while in an ac tive render pass. | |
| 1663 // Thus we must end the current one and then start it up again. | |
| 1664 fCurrentCmdBuffer->endRenderPass(this); | |
|
jvanverth1
2016/04/21 13:25:24
On the first iteration, it doesn't look like we do
egdaniel
2016/04/21 14:09:20
Well we should never get here on the first iterati
| |
| 1641 pipelineState = this->prepareDrawState(pipeline, | 1665 pipelineState = this->prepareDrawState(pipeline, |
| 1642 primProc, | 1666 primProc, |
| 1643 primitiveType, | 1667 primitiveType, |
| 1644 *renderPass); | 1668 *renderPass); |
| 1645 if (!pipelineState) { | 1669 if (!pipelineState) { |
| 1646 return; | 1670 return; |
| 1647 } | 1671 } |
| 1672 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT); | |
| 1648 } | 1673 } |
| 1649 SkASSERT(pipelineState); | 1674 SkASSERT(pipelineState); |
| 1650 this->bindGeometry(primProc, *nonIdxMesh); | 1675 this->bindGeometry(primProc, *nonIdxMesh); |
| 1651 | 1676 |
| 1652 if (nonIdxMesh->isIndexed()) { | 1677 if (nonIdxMesh->isIndexed()) { |
| 1653 fCurrentCmdBuffer->drawIndexed(this, | 1678 fCurrentCmdBuffer->drawIndexed(this, |
| 1654 nonIdxMesh->indexCount(), | 1679 nonIdxMesh->indexCount(), |
| 1655 1, | 1680 1, |
| 1656 nonIdxMesh->startIndex(), | 1681 nonIdxMesh->startIndex(), |
| 1657 nonIdxMesh->startVertex(), | 1682 nonIdxMesh->startVertex(), |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1681 aglSwapBuffers(aglGetCurrentContext()); | 1706 aglSwapBuffers(aglGetCurrentContext()); |
| 1682 int set_a_break_pt_here = 9; | 1707 int set_a_break_pt_here = 9; |
| 1683 aglSwapBuffers(aglGetCurrentContext()); | 1708 aglSwapBuffers(aglGetCurrentContext()); |
| 1684 #elif defined(SK_BUILD_FOR_WIN32) | 1709 #elif defined(SK_BUILD_FOR_WIN32) |
| 1685 SwapBuf(); | 1710 SwapBuf(); |
| 1686 int set_a_break_pt_here = 9; | 1711 int set_a_break_pt_here = 9; |
| 1687 SwapBuf(); | 1712 SwapBuf(); |
| 1688 #endif | 1713 #endif |
| 1689 #endif | 1714 #endif |
| 1690 } | 1715 } |
| OLD | NEW |