| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrVkGpuCommandBuffer.h" | 8 #include "GrVkGpuCommandBuffer.h" |
| 9 | 9 |
| 10 #include "GrFixedClip.h" | 10 #include "GrFixedClip.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // We have sumbitted no actual draw commands to the command buffer and w
e are not using | 111 // We have sumbitted no actual draw commands to the command buffer and w
e are not using |
| 112 // the render pass to do a clear so there is no need to submit anything. | 112 // the render pass to do a clear so there is no need to submit anything. |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 // Change layout of our render target so it can be used as the color attachm
ent. Currently | 117 // Change layout of our render target so it can be used as the color attachm
ent. Currently |
| 118 // we don't attach the resolve to the framebuffer so no need to change its l
ayout. | 118 // we don't attach the resolve to the framebuffer so no need to change its l
ayout. |
| 119 GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma
ge() | 119 GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma
ge() |
| 120 : fRenderTarget; | 120 : fRenderTarget; |
| 121 |
| 122 // Change layout of our render target so it can be used as the color attachm
ent |
| 121 targetImage->setImageLayout(fGpu, | 123 targetImage->setImageLayout(fGpu, |
| 122 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 124 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
| 123 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, | 125 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, |
| 124 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | 126 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, |
| 125 false); | 127 false); |
| 126 | 128 |
| 127 // If we are using a stencil attachment we also need to update its layout | 129 // If we are using a stencil attachment we also need to update its layout |
| 128 if (GrStencilAttachment* stencil = fRenderTarget->renderTargetPriv().getSten
cilAttachment()) { | 130 if (GrStencilAttachment* stencil = fRenderTarget->renderTargetPriv().getSten
cilAttachment()) { |
| 129 GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil; | 131 GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil; |
| 130 vkStencil->setImageLayout(fGpu, | 132 vkStencil->setImageLayout(fGpu, |
| 131 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM
AL, | 133 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM
AL, |
| 132 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | | 134 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | |
| 133 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, | 135 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, |
| 134 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | 136 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, |
| 135 false); | 137 false); |
| 136 } | 138 } |
| 137 | 139 |
| 138 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear
Value, | 140 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear
Value, |
| 139 fRenderTarget, bounds); | 141 fRenderTarget, bounds); |
| 140 } | 142 } |
| 141 | 143 |
| 142 void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) { | 144 void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) { |
| 143 if (fIsEmpty) { | 145 if (fIsEmpty) { |
| 144 // We will change the render pass to do a clear load instead | 146 // We will change the render pass to do a clear load instead |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 fGpu->stats()->incNumDraws(); | 453 fGpu->stats()->incNumDraws(); |
| 452 } while ((nonIdxMesh = iter.next())); | 454 } while ((nonIdxMesh = iter.next())); |
| 453 } | 455 } |
| 454 | 456 |
| 455 // Technically we don't have to call this here (since there is a safety chec
k in | 457 // Technically we don't have to call this here (since there is a safety chec
k in |
| 456 // pipelineState:setData but this will allow for quicker freeing of resource
s if the | 458 // pipelineState:setData but this will allow for quicker freeing of resource
s if the |
| 457 // pipelineState sits in a cache for a while. | 459 // pipelineState sits in a cache for a while. |
| 458 pipelineState->freeTempResources(fGpu); | 460 pipelineState->freeTempResources(fGpu); |
| 459 } | 461 } |
| 460 | 462 |
| OLD | NEW |