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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 *storeOp = VK_ATTACHMENT_STORE_OP_STORE; | 50 *storeOp = VK_ATTACHMENT_STORE_OP_STORE; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 GrVkGpuCommandBuffer::GrVkGpuCommandBuffer(GrVkGpu* gpu, | 54 GrVkGpuCommandBuffer::GrVkGpuCommandBuffer(GrVkGpu* gpu, |
55 GrVkRenderTarget* target, | 55 GrVkRenderTarget* target, |
56 const LoadAndStoreInfo& colorInfo, | 56 const LoadAndStoreInfo& colorInfo, |
57 const LoadAndStoreInfo& stencilInfo) | 57 const LoadAndStoreInfo& stencilInfo) |
58 : fGpu(gpu) | 58 : fGpu(gpu) |
59 , fRenderTarget(target) | 59 , fRenderTarget(target) |
60 , fIsEmpty(true) { | 60 , fIsEmpty(true) |
61 , fHasClearStart(false) { | |
61 VkAttachmentLoadOp vkLoadOp; | 62 VkAttachmentLoadOp vkLoadOp; |
62 VkAttachmentStoreOp vkStoreOp; | 63 VkAttachmentStoreOp vkStoreOp; |
63 | 64 |
64 get_vk_load_store_ops(colorInfo, &vkLoadOp, &vkStoreOp); | 65 get_vk_load_store_ops(colorInfo, &vkLoadOp, &vkStoreOp); |
65 GrVkRenderPass::LoadStoreOps vkColorOps(vkLoadOp, vkStoreOp); | 66 GrVkRenderPass::LoadStoreOps vkColorOps(vkLoadOp, vkStoreOp); |
66 | 67 |
67 get_vk_load_store_ops(stencilInfo, &vkLoadOp, &vkStoreOp); | 68 get_vk_load_store_ops(stencilInfo, &vkLoadOp, &vkStoreOp); |
68 GrVkRenderPass::LoadStoreOps vkStencilOps(vkLoadOp, vkStoreOp); | 69 GrVkRenderPass::LoadStoreOps vkStencilOps(vkLoadOp, vkStoreOp); |
69 | 70 |
70 GrVkRenderPass::LoadStoreOps vkResolveOps(VK_ATTACHMENT_LOAD_OP_LOAD, | 71 GrVkRenderPass::LoadStoreOps vkResolveOps(VK_ATTACHMENT_LOAD_OP_LOAD, |
(...skipping 23 matching lines...) Expand all Loading... | |
94 fRenderPass->unref(fGpu); | 95 fRenderPass->unref(fGpu); |
95 } | 96 } |
96 | 97 |
97 GrGpu* GrVkGpuCommandBuffer::gpu() { return fGpu; } | 98 GrGpu* GrVkGpuCommandBuffer::gpu() { return fGpu; } |
98 | 99 |
99 void GrVkGpuCommandBuffer::end() { | 100 void GrVkGpuCommandBuffer::end() { |
100 fCommandBuffer->end(fGpu); | 101 fCommandBuffer->end(fGpu); |
101 } | 102 } |
102 | 103 |
103 void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { | 104 void GrVkGpuCommandBuffer::onSubmit(const SkIRect& bounds) { |
105 if (fIsEmpty && !fHasClearStart) { | |
egdaniel
2016/09/12 20:40:09
If we grab a texture to which we immediately want
| |
106 // We have sumbitted now actual draw commands the the command buffer and we are not using | |
Brian Osman
2016/09/12 20:45:05
s/now/no/ ?
s/the the/to the/ ?
jvanverth1
2016/09/12 20:48:23
submitted no actual draw commands to the
egdaniel
2016/09/12 21:14:32
Done.
| |
107 // the render pass to do a clear so there is no need to submit anything. | |
108 return; | |
109 } | |
110 | |
104 // Change layout of our render target so it can be used as the color attachm ent. Currently | 111 // Change layout of our render target so it can be used as the color attachm ent. Currently |
105 // we don't attach the resolve to the framebuffer so no need to change its l ayout. | 112 // we don't attach the resolve to the framebuffer so no need to change its l ayout. |
106 GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma ge() | 113 GrVkImage* targetImage = fRenderTarget->msaaImage() ? fRenderTarget->msaaIma ge() |
107 : fRenderTarget; | 114 : fRenderTarget; |
108 targetImage->setImageLayout(fGpu, | 115 targetImage->setImageLayout(fGpu, |
109 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, | 116 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, |
110 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, | 117 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, |
111 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, | 118 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, |
112 false); | 119 false); |
113 | 120 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 fGpu->stats()->incNumDraws(); | 443 fGpu->stats()->incNumDraws(); |
437 } while ((nonIdxMesh = iter.next())); | 444 } while ((nonIdxMesh = iter.next())); |
438 } | 445 } |
439 | 446 |
440 // Technically we don't have to call this here (since there is a safety chec k in | 447 // Technically we don't have to call this here (since there is a safety chec k in |
441 // pipelineState:setData but this will allow for quicker freeing of resource s if the | 448 // pipelineState:setData but this will allow for quicker freeing of resource s if the |
442 // pipelineState sits in a cache for a while. | 449 // pipelineState sits in a cache for a while. |
443 pipelineState->freeTempResources(fGpu); | 450 pipelineState->freeTempResources(fGpu); |
444 } | 451 } |
445 | 452 |
OLD | NEW |