More threadpool bs

This commit is contained in:
Dynamitos
2021-12-02 13:00:03 +01:00
parent 5fafdda770
commit 9e3a2446ce
37 changed files with 488 additions and 541 deletions
+6 -6
View File
@@ -65,15 +65,15 @@ ShaderBuffer::~ShaderBuffer()
{
PCmdBuffer cmdBuffer = graphics->getQueueCommands(owner)->getCommands();
VkDevice device = graphics->getDevice();
auto deletionLambda = [](PCmdBuffer cmdBuffer, VkDevice device, VkBuffer buffer) -> Job
auto deletionLambda = [cmdBuffer, device](VkBuffer buffer) -> Job
{
co_await cmdBuffer->asyncWait();
vkDestroyBuffer(device, buffer, nullptr);
co_return;
};
//co_await cmdBuffer->asyncWait();
//vkDestroyBuffer(device, buffer, nullptr);
co_return;
};
for (uint32 i = 0; i < numBuffers; ++i)
{
deletionLambda(cmdBuffer, device, buffers[i].buffer);
deletionLambda(buffers[i].buffer);
buffers[i].allocation = nullptr;
}
graphics = nullptr;
@@ -85,6 +85,10 @@ void CmdBuffer::endRenderPass()
void CmdBuffer::executeCommands(const Array<Gfx::PRenderCommand>& commands)
{
assert(state == State::RenderPassActive);
if(commands.size() == 0)
{
return;
}
std::unique_lock lock(handleLock);
Array<VkCommandBuffer> cmdBuffers(commands.size());
for (uint32 i = 0; i < commands.size(); ++i)
@@ -105,6 +109,10 @@ void CmdBuffer::executeCommands(const Array<Gfx::PRenderCommand>& commands)
void CmdBuffer::executeCommands(const Array<Gfx::PComputeCommand>& commands)
{
std::unique_lock lock(handleLock);
if(commands.size() == 0)
{
return;
}
Array<VkCommandBuffer> cmdBuffers(commands.size());
for (uint32 i = 0; i < commands.size(); ++i)
{
+2 -2
View File
@@ -168,8 +168,8 @@ TextureHandle::~TextureHandle()
VkImage img = image;
auto deletionLambda = [cmdBuffer, device, view, img]() -> Job
{
vkDestroyImageView(device, view, nullptr);
vkDestroyImage(device, img, nullptr);
//vkDestroyImageView(device, view, nullptr);
//vkDestroyImage(device, img, nullptr);
co_return;
};
deletionLambda();