More threadpool bs
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user