Chromium Code Reviews| 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 "GrMesh.h" | 10 #include "GrMesh.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIM AL, | 123 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIM AL, |
| 124 VK_ACCESS_SHADER_READ_BIT, | 124 VK_ACCESS_SHADER_READ_BIT, |
| 125 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, | 125 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, |
| 126 false); | 126 false); |
| 127 } | 127 } |
| 128 | 128 |
| 129 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear Value, | 129 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear Value, |
| 130 fRenderTarget, bounds); | 130 fRenderTarget, bounds); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) { | |
| 134 if (fIsEmpty) { | |
| 135 // We will change the render pass to do a clear load instead | |
| 136 GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_DONT_CARE, | |
| 137 VK_ATTACHMENT_STORE_OP_STORE); | |
| 138 GrVkRenderPass::LoadStoreOps vkStencilOps(VK_ATTACHMENT_LOAD_OP_LOAD, | |
|
jvanverth1
2016/06/29 16:00:30
Shouldn't this and the resolve be LOAD_OP_DONT_CAR
egdaniel
2016/06/29 16:11:30
In general, when we call discard on a RT do we mea
bsalomon
2016/06/29 17:45:24
both, I guess? The current discard stuff is not us
| |
| 139 VK_ATTACHMENT_STORE_OP_STORE); | |
| 140 GrVkRenderPass::LoadStoreOps vkResolveOps(VK_ATTACHMENT_LOAD_OP_LOAD, | |
| 141 VK_ATTACHMENT_STORE_OP_STORE); | |
| 142 | |
| 143 const GrVkRenderPass* oldRP = fRenderPass; | |
| 144 | |
| 145 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | |
| 146 const GrVkResourceProvider::CompatibleRPHandle& rpHandle = | |
| 147 vkRT->compatibleRenderPassHandle(); | |
| 148 if (rpHandle.isValid()) { | |
| 149 fRenderPass = fGpu->resourceProvider().findRenderPass(rpHandle, | |
| 150 vkColorOps, | |
| 151 vkResolveOps, | |
| 152 vkStencilOps); | |
| 153 } else { | |
| 154 fRenderPass = fGpu->resourceProvider().findRenderPass(*vkRT, | |
| 155 vkColorOps, | |
| 156 vkResolveOps, | |
| 157 vkStencilOps); | |
| 158 } | |
| 159 | |
| 160 SkASSERT(fRenderPass->isCompatible(*oldRP)); | |
| 161 oldRP->unref(fGpu); | |
| 162 } | |
| 163 } | |
| 164 | |
| 133 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, | 165 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
| 134 const SkIRect& rect, | 166 const SkIRect& rect, |
| 135 bool insideClip) { | 167 bool insideClip) { |
| 136 SkASSERT(target); | 168 SkASSERT(target); |
| 137 | 169 |
| 138 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | 170 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
| 139 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); | 171 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); |
| 140 // this should only be called internally when we know we have a | 172 // this should only be called internally when we know we have a |
| 141 // stencil buffer. | 173 // stencil buffer. |
| 142 SkASSERT(sb); | 174 SkASSERT(sb); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 fGpu->stats()->incNumDraws(); | 420 fGpu->stats()->incNumDraws(); |
| 389 } while ((nonIdxMesh = iter.next())); | 421 } while ((nonIdxMesh = iter.next())); |
| 390 } | 422 } |
| 391 | 423 |
| 392 // Technically we don't have to call this here (since there is a safety chec k in | 424 // Technically we don't have to call this here (since there is a safety chec k in |
| 393 // pipelineState:setData but this will allow for quicker freeing of resource s if the | 425 // pipelineState:setData but this will allow for quicker freeing of resource s if the |
| 394 // pipelineState sits in a cache for a while. | 426 // pipelineState sits in a cache for a while. |
| 395 pipelineState->freeTempResources(fGpu); | 427 pipelineState->freeTempResources(fGpu); |
| 396 } | 428 } |
| 397 | 429 |
| OLD | NEW |