Index: src/gpu/vk/GrVkCommandBuffer.h |
diff --git a/src/gpu/vk/GrVkCommandBuffer.h b/src/gpu/vk/GrVkCommandBuffer.h |
index 95935f090869e026eeabe5871063ab32eab9b1fe..525ea776bb2bcb234bdf20a1efd3b5b6250589da 100644 |
--- a/src/gpu/vk/GrVkCommandBuffer.h |
+++ b/src/gpu/vk/GrVkCommandBuffer.h |
@@ -117,6 +117,8 @@ public: |
fTrackedResources.push_back(resource); |
} |
+ void reset(GrVkGpu* gpu); |
+ |
protected: |
GrVkCommandBuffer(VkCommandBuffer cmdBuffer, const GrVkRenderPass* rp = VK_NULL_HANDLE) |
: fTrackedResources(kInitialTrackedResourcesCount) |
@@ -147,6 +149,8 @@ private: |
virtual void onFreeGPUData(const GrVkGpu* gpu) const = 0; |
void abandonSubResources() const override; |
+ virtual void onReset(GrVkGpu* gpu) {} |
+ |
VkBuffer fBoundVertexBuffer; |
bool fBoundVertexBufferIsValid; |
@@ -185,7 +189,7 @@ public: |
// currently inside a render pass that is compatible with the one used to create the |
// SecondaryCommandBuffer. |
void executeCommands(const GrVkGpu* gpu, |
- const GrVkSecondaryCommandBuffer* secondaryBuffer); |
+ GrVkSecondaryCommandBuffer* secondaryBuffer); |
// Commands that only work outside of a render pass |
void clearColorImage(const GrVkGpu* gpu, |
@@ -260,6 +264,12 @@ public: |
void submitToQueue(const GrVkGpu* gpu, VkQueue queue, GrVkGpu::SyncQueue sync); |
bool finished(const GrVkGpu* gpu) const; |
+#ifdef SK_TRACE_VK_RESOURCES |
+ void dumpInfo() const override { |
+ SkDebugf("GrVkPrimaryCommandBuffer: %d (%d refs)\n", fCmdBuffer, this->getRefCnt()); |
+ } |
+#endif |
+ |
private: |
explicit GrVkPrimaryCommandBuffer(VkCommandBuffer cmdBuffer) |
: INHERITED(cmdBuffer) |
@@ -267,23 +277,31 @@ private: |
void onFreeGPUData(const GrVkGpu* gpu) const override; |
- VkFence fSubmitFence; |
+ void onReset(GrVkGpu* gpu) override; |
+ |
+ SkTArray<GrVkSecondaryCommandBuffer*, true> fSecondaryCommandBuffers; |
+ VkFence fSubmitFence; |
typedef GrVkCommandBuffer INHERITED; |
}; |
class GrVkSecondaryCommandBuffer : public GrVkCommandBuffer { |
public: |
- static GrVkSecondaryCommandBuffer* Create(const GrVkGpu* gpu, VkCommandPool cmdPool, |
- const GrVkRenderPass* compatibleRenderPass); |
+ static GrVkSecondaryCommandBuffer* Create(const GrVkGpu* gpu, VkCommandPool cmdPool); |
- void begin(const GrVkGpu* gpu, const GrVkFramebuffer* framebuffer); |
+ void begin(const GrVkGpu* gpu, const GrVkFramebuffer* framebuffer, |
+ const GrVkRenderPass* compatibleRenderPass); |
void end(const GrVkGpu* gpu); |
+#ifdef SK_TRACE_VK_RESOURCES |
+ void dumpInfo() const override { |
+ SkDebugf("GrVkSecondaryCommandBuffer: %d (%d refs)\n", fCmdBuffer, this->getRefCnt()); |
+ } |
+#endif |
+ |
private: |
- explicit GrVkSecondaryCommandBuffer(VkCommandBuffer cmdBuffer, |
- const GrVkRenderPass* compatibleRenderPass) |
- : INHERITED(cmdBuffer, compatibleRenderPass) { |
+ explicit GrVkSecondaryCommandBuffer(VkCommandBuffer cmdBuffer) |
+ : INHERITED(cmdBuffer) { |
} |
void onFreeGPUData(const GrVkGpu* gpu) const override {} |