Add resource tracking output and command buffer recycling
BUG=skia:5042
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2115993002
Review-Url: https://codereview.chromium.org/2115993002
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index e907d8d..6875824 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -127,17 +127,18 @@
VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhysDevMemProps));
const VkCommandPoolCreateInfo cmdPoolInfo = {
- VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType
- nullptr, // pNext
- VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // CmdPoolCreateFlags
- backendCtx->fGraphicsQueueIndex, // queueFamilyIndex
+ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType
+ nullptr, // pNext
+ VK_COMMAND_POOL_CREATE_TRANSIENT_BIT |
+ VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, // CmdPoolCreateFlags
+ backendCtx->fGraphicsQueueIndex, // queueFamilyIndex
};
GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateCommandPool(fDevice, &cmdPoolInfo, nullptr,
&fCmdPool));
// must call this after creating the CommandPool
fResourceProvider.init();
- fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer();
+ fCurrentCmdBuffer = fResourceProvider.findOrCreatePrimaryCommandBuffer();
SkASSERT(fCurrentCmdBuffer);
fCurrentCmdBuffer->begin(this);
@@ -217,7 +218,7 @@
// Release old command buffer and create a new one
fCurrentCmdBuffer->unref(this);
- fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer();
+ fCurrentCmdBuffer = fResourceProvider.findOrCreatePrimaryCommandBuffer();
SkASSERT(fCurrentCmdBuffer);
fCurrentCmdBuffer->begin(this);
@@ -1495,7 +1496,7 @@
return true;
}
-void GrVkGpu::submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer* buffer,
+void GrVkGpu::submitSecondaryCommandBuffer(GrVkSecondaryCommandBuffer* buffer,
const GrVkRenderPass* renderPass,
const VkClearValue* colorClear,
GrVkRenderTarget* target,