Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: src/gpu/vk/GrVkCommandBuffer.h

Issue 2115993002: Add resource tracking output and command buffer recycling (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkCommandBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {}
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkCommandBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698