| 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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 const GrMesh* meshes, | 1489 const GrMesh* meshes, |
| 1490 int meshCount) { | 1490 int meshCount) { |
| 1491 if (!meshCount) { | 1491 if (!meshCount) { |
| 1492 return; | 1492 return; |
| 1493 } | 1493 } |
| 1494 GrRenderTarget* rt = pipeline.getRenderTarget(); | 1494 GrRenderTarget* rt = pipeline.getRenderTarget(); |
| 1495 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); | 1495 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); |
| 1496 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); | 1496 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); |
| 1497 SkASSERT(renderPass); | 1497 SkASSERT(renderPass); |
| 1498 | 1498 |
| 1499 | |
| 1500 GrPrimitiveType primitiveType = meshes[0].primitiveType(); | 1499 GrPrimitiveType primitiveType = meshes[0].primitiveType(); |
| 1501 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, | 1500 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, |
| 1502 primProc, | 1501 primProc, |
| 1503 primitiveTyp
e, | 1502 primitiveTyp
e, |
| 1504 *renderPass)
; | 1503 *renderPass)
; |
| 1505 if (!pipelineState) { | 1504 if (!pipelineState) { |
| 1506 return; | 1505 return; |
| 1507 } | 1506 } |
| 1508 | 1507 |
| 1509 // Change layout of our render target so it can be used as the color attachm
ent | 1508 // Change layout of our render target so it can be used as the color attachm
ent |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 GrMesh::Iterator iter; | 1545 GrMesh::Iterator iter; |
| 1547 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); | 1546 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); |
| 1548 do { | 1547 do { |
| 1549 if (nonIdxMesh->primitiveType() != primitiveType) { | 1548 if (nonIdxMesh->primitiveType() != primitiveType) { |
| 1550 // Technically we don't have to call this here (since there is a
safety check in | 1549 // Technically we don't have to call this here (since there is a
safety check in |
| 1551 // pipelineState:setData but this will allow for quicker freeing
of resources if the | 1550 // pipelineState:setData but this will allow for quicker freeing
of resources if the |
| 1552 // pipelineState sits in a cache for a while. | 1551 // pipelineState sits in a cache for a while. |
| 1553 pipelineState->freeTempResources(this); | 1552 pipelineState->freeTempResources(this); |
| 1554 SkDEBUGCODE(pipelineState = nullptr); | 1553 SkDEBUGCODE(pipelineState = nullptr); |
| 1555 primitiveType = nonIdxMesh->primitiveType(); | 1554 primitiveType = nonIdxMesh->primitiveType(); |
| 1556 // It is illegal for us to have the necessary memory barriers fo
r when we write and | |
| 1557 // update the uniform buffers in prepareDrawState while in an ac
tive render pass. | |
| 1558 // Thus we must end the current one and then start it up again. | |
| 1559 fCurrentCmdBuffer->endRenderPass(this); | |
| 1560 pipelineState = this->prepareDrawState(pipeline, | 1555 pipelineState = this->prepareDrawState(pipeline, |
| 1561 primProc, | 1556 primProc, |
| 1562 primitiveType, | 1557 primitiveType, |
| 1563 *renderPass); | 1558 *renderPass); |
| 1564 if (!pipelineState) { | 1559 if (!pipelineState) { |
| 1565 return; | 1560 return; |
| 1566 } | 1561 } |
| 1567 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT); | |
| 1568 } | 1562 } |
| 1569 SkASSERT(pipelineState); | 1563 SkASSERT(pipelineState); |
| 1570 this->bindGeometry(primProc, *nonIdxMesh); | 1564 this->bindGeometry(primProc, *nonIdxMesh); |
| 1571 | 1565 |
| 1572 if (nonIdxMesh->isIndexed()) { | 1566 if (nonIdxMesh->isIndexed()) { |
| 1573 fCurrentCmdBuffer->drawIndexed(this, | 1567 fCurrentCmdBuffer->drawIndexed(this, |
| 1574 nonIdxMesh->indexCount(), | 1568 nonIdxMesh->indexCount(), |
| 1575 1, | 1569 1, |
| 1576 nonIdxMesh->startIndex(), | 1570 nonIdxMesh->startIndex(), |
| 1577 nonIdxMesh->startVertex(), | 1571 nonIdxMesh->startVertex(), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1601 aglSwapBuffers(aglGetCurrentContext()); | 1595 aglSwapBuffers(aglGetCurrentContext()); |
| 1602 int set_a_break_pt_here = 9; | 1596 int set_a_break_pt_here = 9; |
| 1603 aglSwapBuffers(aglGetCurrentContext()); | 1597 aglSwapBuffers(aglGetCurrentContext()); |
| 1604 #elif defined(SK_BUILD_FOR_WIN32) | 1598 #elif defined(SK_BUILD_FOR_WIN32) |
| 1605 SwapBuf(); | 1599 SwapBuf(); |
| 1606 int set_a_break_pt_here = 9; | 1600 int set_a_break_pt_here = 9; |
| 1607 SwapBuf(); | 1601 SwapBuf(); |
| 1608 #endif | 1602 #endif |
| 1609 #endif | 1603 #endif |
| 1610 } | 1604 } |
| OLD | NEW |