| 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 #ifndef GrVkCommandBuffer_DEFINED | 8 #ifndef GrVkCommandBuffer_DEFINED |
| 9 #define GrVkCommandBuffer_DEFINED | 9 #define GrVkCommandBuffer_DEFINED |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 uint32_t firstVertex, | 110 uint32_t firstVertex, |
| 111 uint32_t firstInstance) const; | 111 uint32_t firstInstance) const; |
| 112 | 112 |
| 113 // Add ref-counted resource that will be tracked and released when this | 113 // Add ref-counted resource that will be tracked and released when this |
| 114 // command buffer finishes execution | 114 // command buffer finishes execution |
| 115 void addResource(const GrVkResource* resource) { | 115 void addResource(const GrVkResource* resource) { |
| 116 resource->ref(); | 116 resource->ref(); |
| 117 fTrackedResources.push_back(resource); | 117 fTrackedResources.push_back(resource); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Add ref-counted resource that will be tracked and released when this comm
and buffer finishes |
| 121 // execution. When it is released, it will signal that the resource can be r
ecycled for reuse. |
| 122 void addRecycledResource(const GrVkRecycledResource* resource) { |
| 123 resource->ref(); |
| 124 fTrackedRecycledResources.push_back(resource); |
| 125 } |
| 126 |
| 120 void reset(GrVkGpu* gpu); | 127 void reset(GrVkGpu* gpu); |
| 121 | 128 |
| 122 protected: | 129 protected: |
| 123 GrVkCommandBuffer(VkCommandBuffer cmdBuffer, const GrVkRenderPass* rp =
VK_NULL_HANDLE) | 130 GrVkCommandBuffer(VkCommandBuffer cmdBuffer, const GrVkRenderPass* rp =
VK_NULL_HANDLE) |
| 124 : fTrackedResources(kInitialTrackedResourcesCount) | 131 : fTrackedResources(kInitialTrackedResourcesCount) |
| 132 , fTrackedRecycledResources(kInitialTrackedResourcesCount) |
| 125 , fIsActive(false) | 133 , fIsActive(false) |
| 126 , fActiveRenderPass(rp) | 134 , fActiveRenderPass(rp) |
| 127 , fCmdBuffer(cmdBuffer) | 135 , fCmdBuffer(cmdBuffer) |
| 128 , fBoundVertexBufferIsValid(false) | 136 , fBoundVertexBufferIsValid(false) |
| 129 , fBoundIndexBufferIsValid(false) { | 137 , fBoundIndexBufferIsValid(false) { |
| 130 this->invalidateState(); | 138 this->invalidateState(); |
| 131 } | 139 } |
| 132 SkTArray<const GrVkResource*, true> fTrackedResources; | 140 SkTArray<const GrVkResource*, true> fTrackedResources; |
| 141 SkTArray<const GrVkRecycledResource*, true> fTrackedRecycledResources; |
| 133 | 142 |
| 134 // Tracks whether we are in the middle of a command buffer begin/end cal
ls and thus can add | 143 // Tracks whether we are in the middle of a command buffer begin/end cal
ls and thus can add |
| 135 // new commands to the buffer; | 144 // new commands to the buffer; |
| 136 bool fIsActive; | 145 bool fIsActive; |
| 137 | 146 |
| 138 // Stores a pointer to the current active render pass (i.e. begin has be
en called but not | 147 // Stores a pointer to the current active render pass (i.e. begin has be
en called but not |
| 139 // end). A nullptr means there is no active render pass. The GrVKCommand
Buffer does not own | 148 // end). A nullptr means there is no active render pass. The GrVKCommand
Buffer does not own |
| 140 // the render pass. | 149 // the render pass. |
| 141 const GrVkRenderPass* fActiveRenderPass; | 150 const GrVkRenderPass* fActiveRenderPass; |
| 142 | 151 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 314 } |
| 306 | 315 |
| 307 void onFreeGPUData(const GrVkGpu* gpu) const override {} | 316 void onFreeGPUData(const GrVkGpu* gpu) const override {} |
| 308 | 317 |
| 309 friend class GrVkPrimaryCommandBuffer; | 318 friend class GrVkPrimaryCommandBuffer; |
| 310 | 319 |
| 311 typedef GrVkCommandBuffer INHERITED; | 320 typedef GrVkCommandBuffer INHERITED; |
| 312 }; | 321 }; |
| 313 | 322 |
| 314 #endif | 323 #endif |
| OLD | NEW |