| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 95     fRenderPass->unref(fGpu); | 95     fRenderPass->unref(fGpu); | 
| 96 } | 96 } | 
| 97 | 97 | 
| 98 GrGpu* GrVkGpuCommandBuffer::gpu() { return fGpu; } | 98 GrGpu* GrVkGpuCommandBuffer::gpu() { return fGpu; } | 
| 99 | 99 | 
| 100 void GrVkGpuCommandBuffer::end() { | 100 void GrVkGpuCommandBuffer::end() { | 
| 101     fCommandBuffer->end(fGpu); | 101     fCommandBuffer->end(fGpu); | 
| 102 } | 102 } | 
| 103 | 103 | 
| 104 void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { | 104 void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { | 
|  | 105     // TODO: We can't add this optimization yet since many things create a scrat
     ch texture which | 
|  | 106     // adds the discard immediately, but then don't draw to it right away. This 
     causes the discard | 
|  | 107     // to be ignored and we get yelled at for loading uninitialized data. Howeve
     r, once MDP lands, | 
|  | 108     // the discard will get reordered with the rest of the draw commands and we 
     can re-enable this. | 
|  | 109 #if 0 | 
| 105     if (fIsEmpty && !fStartsWithClear) { | 110     if (fIsEmpty && !fStartsWithClear) { | 
| 106         // 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 | 
| 107         // 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. | 
| 108         return; | 113         return; | 
| 109     } | 114     } | 
|  | 115 #endif | 
| 110 | 116 | 
| 111     // 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 | 
| 112     // 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. | 
| 113     GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma
     ge() | 119     GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma
     ge() | 
| 114                                                         : fRenderTarget; | 120                                                         : fRenderTarget; | 
| 115     targetImage->setImageLayout(fGpu, | 121     targetImage->setImageLayout(fGpu, | 
| 116                                 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 122                                 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 
| 117                                 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, | 123                                 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, | 
| 118                                 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | 124                                 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | 
| 119                                 false); | 125                                 false); | 
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 445             fGpu->stats()->incNumDraws(); | 451             fGpu->stats()->incNumDraws(); | 
| 446         } while ((nonIdxMesh = iter.next())); | 452         } while ((nonIdxMesh = iter.next())); | 
| 447     } | 453     } | 
| 448 | 454 | 
| 449     // Technically we don't have to call this here (since there is a safety chec
     k in | 455     // Technically we don't have to call this here (since there is a safety chec
     k in | 
| 450     // pipelineState:setData but this will allow for quicker freeing of resource
     s if the | 456     // pipelineState:setData but this will allow for quicker freeing of resource
     s if the | 
| 451     // pipelineState sits in a cache for a while. | 457     // pipelineState sits in a cache for a while. | 
| 452     pipelineState->freeTempResources(fGpu); | 458     pipelineState->freeTempResources(fGpu); | 
| 453 } | 459 } | 
| 454 | 460 | 
| OLD | NEW | 
|---|